@ohhwells/bridge 0.1.161 → 0.1.163-next.434

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) {
@@ -3610,11 +3616,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
3610
3616
  container.appendChild(column);
3611
3617
  return { column, firstLink };
3612
3618
  }
3613
- function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
3619
+ function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
3614
3620
  if (!canAddFooterColumn()) {
3615
3621
  throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
3616
3622
  }
3617
- const resolvedHref = linkHref || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
3623
+ const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
3618
3624
  const colIndex = getNextFooterColumnIndex();
3619
3625
  const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
3620
3626
  if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
@@ -3993,8 +3999,8 @@ function duplicateFooterItem(sourceAnchor) {
3993
3999
  const column = findFooterColumnForLink(sourceAnchor);
3994
4000
  if (!column) return null;
3995
4001
  const href = getLinkHref(sourceAnchor);
3996
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
3997
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
4002
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4003
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
3998
4004
  return insertFooterItem(column, href || "/", label, sourceAnchor);
3999
4005
  }
4000
4006
  function footerLabelKeyFromHrefKey(hrefKey) {
@@ -4004,8 +4010,8 @@ function deleteFooterItem(sourceAnchor) {
4004
4010
  if (!isFooterLinkAnchor(sourceAnchor)) return null;
4005
4011
  const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
4006
4012
  if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
4007
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4008
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
4013
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4014
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
4009
4015
  const labelKey = footerLabelKeyFromHrefKey(hrefKey);
4010
4016
  const previousOrder = getFooterOrderFromDom();
4011
4017
  const previousOrderJson = JSON.stringify(previousOrder);
@@ -4973,8 +4979,8 @@ function remapNavKeysInSubtree(root, keyMap) {
4973
4979
  const mapped = keyMap.get(oldHrefKey);
4974
4980
  if (!mapped) return;
4975
4981
  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);
4982
+ const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
4983
+ if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
4978
4984
  };
4979
4985
  if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
4980
4986
  root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
@@ -4982,10 +4988,10 @@ function remapNavKeysInSubtree(root, keyMap) {
4982
4988
  function readNavLinkSnapshot(hrefKey) {
4983
4989
  const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
4984
4990
  if (!el) return { href: "/", label: "Untitled" };
4985
- const labelEl = el.querySelector('[data-ohw-editable="text"]');
4991
+ const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
4986
4992
  return {
4987
4993
  href: getLinkHref2(el),
4988
- label: (labelEl?.textContent ?? "").trim() || "Untitled"
4994
+ label: (labelEl2?.textContent ?? "").trim() || "Untitled"
4989
4995
  };
4990
4996
  }
4991
4997
  function findClonedNavAnchor(unit, hrefKey) {
@@ -5159,8 +5165,8 @@ function deleteNavbarItem(sourceAnchor) {
5159
5165
  if (!isNavbarLinkItem(sourceAnchor)) return null;
5160
5166
  const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
5161
5167
  if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
5162
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
5163
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
5168
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
5169
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
5164
5170
  const previousForest = getNavForestFromDom();
5165
5171
  const previousOrderJson = serializeNavOrder(previousForest);
5166
5172
  const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
@@ -6763,6 +6769,21 @@ function pricingCardFeatureCount(tree, index) {
6763
6769
  const target = findPricingCollection(tree)?.children?.[index];
6764
6770
  return target ? pricingFeatureList(target).length : 0;
6765
6771
  }
6772
+ function prevailingFeatureIcon(features) {
6773
+ const counts = /* @__PURE__ */ new Map();
6774
+ for (const row of features) {
6775
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6776
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6777
+ entry.count += 1;
6778
+ counts.set(key, entry);
6779
+ }
6780
+ let best = null;
6781
+ for (const entry of counts.values()) {
6782
+ if (!best || entry.count > best.count) best = entry;
6783
+ }
6784
+ if (!best) return {};
6785
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6786
+ }
6766
6787
  function addPricingCardFeature(tree, index, text) {
6767
6788
  return withPricingCollection(tree, (collection) => {
6768
6789
  const children = collection.children;
@@ -6771,7 +6792,7 @@ function addPricingCardFeature(tree, index, text) {
6771
6792
  const features = pricingFeatureList(target);
6772
6793
  if (features.length >= PRICING_FEATURES_MAX) return false;
6773
6794
  target.slots = target.slots ?? {};
6774
- target.slots.features = [...features, { text }];
6795
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6775
6796
  return true;
6776
6797
  });
6777
6798
  }
@@ -7415,6 +7436,120 @@ function findSelectableNavContainer(doc = document) {
7415
7436
  );
7416
7437
  }
7417
7438
 
7439
+ // src/lib/youtube.ts
7440
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7441
+ function extractYouTubeId(input) {
7442
+ const trimmed = input.trim();
7443
+ if (!trimmed) return null;
7444
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7445
+ let url;
7446
+ try {
7447
+ url = new URL(trimmed);
7448
+ } catch {
7449
+ return null;
7450
+ }
7451
+ const host = url.hostname.replace(/^www\./, "");
7452
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7453
+ return null;
7454
+ }
7455
+ let candidate = null;
7456
+ if (host === "youtu.be") {
7457
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7458
+ } else if (url.pathname === "/watch") {
7459
+ candidate = url.searchParams.get("v");
7460
+ } else {
7461
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7462
+ candidate = match ? match[1] : null;
7463
+ }
7464
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7465
+ }
7466
+
7467
+ // src/lib/section-embed.ts
7468
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7469
+ function readStoredEmbed(value) {
7470
+ if (value.startsWith("start\n")) {
7471
+ return { raw: value.slice("start\n".length), at: "start" };
7472
+ }
7473
+ return { raw: value, at: "end" };
7474
+ }
7475
+ function embedFrameSrc(value) {
7476
+ const videoId = extractYouTubeId(value);
7477
+ if (videoId) {
7478
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7479
+ }
7480
+ let url;
7481
+ try {
7482
+ url = new URL(value);
7483
+ } catch {
7484
+ return null;
7485
+ }
7486
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7487
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7488
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7489
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7490
+ return { src, title: "Map" };
7491
+ }
7492
+ if (host === "maps.app.goo.gl") {
7493
+ return { src: value, title: "Map" };
7494
+ }
7495
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7496
+ return { src: value, title: "Calendar" };
7497
+ }
7498
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7499
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7500
+ }
7501
+ if (host === "forms.gle") {
7502
+ return { src: value, title: "Form" };
7503
+ }
7504
+ return null;
7505
+ }
7506
+ function place(section, box, at) {
7507
+ if (at === "start") {
7508
+ section.insertBefore(box, section.firstChild);
7509
+ return;
7510
+ }
7511
+ section.appendChild(box);
7512
+ }
7513
+ function paint(section, key, src, title, at) {
7514
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7515
+ const frame = existing?.querySelector("iframe");
7516
+ if (existing && frame) {
7517
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7518
+ frame.title = title;
7519
+ place(section, existing, at);
7520
+ return;
7521
+ }
7522
+ existing?.remove();
7523
+ const box = document.createElement("div");
7524
+ box.setAttribute("data-ohw-section-embed", key);
7525
+ 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;";
7526
+ const frameWrap = document.createElement("div");
7527
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7528
+ const iframe = document.createElement("iframe");
7529
+ iframe.src = src;
7530
+ iframe.title = title;
7531
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7532
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7533
+ iframe.setAttribute("allowfullscreen", "");
7534
+ frameWrap.appendChild(iframe);
7535
+ box.appendChild(frameWrap);
7536
+ place(section, box, at);
7537
+ }
7538
+ function applySectionEmbeds(content) {
7539
+ for (const [key, val] of Object.entries(content)) {
7540
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7541
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7542
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7543
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7544
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7545
+ if (!section || !stored || !frame) {
7546
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7547
+ continue;
7548
+ }
7549
+ paint(section, key, frame.src, frame.title, stored.at);
7550
+ }
7551
+ }
7552
+
7418
7553
  // src/ui/ai-tree/aiSectionsManager.tsx
7419
7554
  var import_react_dom = require("react-dom");
7420
7555
  var import_client = require("react-dom/client");
@@ -7988,7 +8123,7 @@ var AI_MOBILE_CSS = [
7988
8123
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
7989
8124
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
7990
8125
  // 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`.
8126
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
7992
8127
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
7993
8128
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
7994
8129
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8004,8 +8139,10 @@ var AI_MOBILE_CSS = [
8004
8139
  "[data-ai-section]{overflow-x:hidden}",
8005
8140
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8006
8141
  // 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}",
8142
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8143
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8144
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8145
+ "[data-ai-container]{padding:0 20px !important}",
8009
8146
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8010
8147
  "[data-ai-cell]{width:100%;min-width:0}",
8011
8148
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8210,6 +8347,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8210
8347
  function textAttrs(ctx, path) {
8211
8348
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8212
8349
  }
8350
+ var AI_RESPONSIVE_CSS = [
8351
+ "@media (max-width: 960px) {",
8352
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8353
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8354
+ "}",
8355
+ "@media (max-width: 640px) {",
8356
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8357
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8358
+ // Group containers flatten to a column on phones; span placements come along for free.
8359
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8360
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8361
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8362
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8363
+ // layered text used to be.
8364
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8365
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8366
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8367
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8368
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8369
+ // other rule had already been taught to stand down.
8370
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8371
+ " [data-ai-responsive] { overflow-x: hidden; }",
8372
+ " [data-ai-responsive] img { max-width: 100%; }",
8373
+ "}"
8374
+ ].join("\n");
8213
8375
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8214
8376
  function MediaBox({
8215
8377
  refValue,
@@ -8264,7 +8426,7 @@ function MediaBox({
8264
8426
  position: fill ? "absolute" : void 0,
8265
8427
  inset: fill ? 0 : void 0,
8266
8428
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8267
- height: fill ? "100%" : void 0,
8429
+ height: fill ? "100%" : fixedSize ? height : void 0,
8268
8430
  aspectRatio: fill ? void 0 : aspectRatio,
8269
8431
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8270
8432
  borderRadius: radius,
@@ -9760,7 +9922,7 @@ function CollectionBlock({ node, ctx, path }) {
9760
9922
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
9761
9923
  "div",
9762
9924
  {
9763
- "data-ai-grid": "",
9925
+ "data-ai-grid": String(itemsPerRow),
9764
9926
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9765
9927
  style: {
9766
9928
  display: "grid",
@@ -10062,7 +10224,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10062
10224
  },
10063
10225
  children: [
10064
10226
  i > 0 && ctx.heroOverlapFullBleed ? (
10065
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10227
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10066
10228
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10067
10229
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10068
10230
  // the full section width instead of reading at the usual content width.
@@ -10481,6 +10643,7 @@ function AiTreeRenderer({
10481
10643
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10482
10644
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10483
10645
  ...bgAttrs,
10646
+ "data-ai-responsive": "",
10484
10647
  style: {
10485
10648
  position: "relative",
10486
10649
  padding: `${padCss} 0`,
@@ -10494,12 +10657,13 @@ function AiTreeRenderer({
10494
10657
  ...fillHeight ? { display: "grid" } : {}
10495
10658
  },
10496
10659
  children: [
10497
- isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10660
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
10498
10661
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
10662
+ isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10499
10663
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10500
10664
  "div",
10501
10665
  {
10502
- "data-ai-container": "",
10666
+ "data-ai-section-inner": "",
10503
10667
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10504
10668
  style: {
10505
10669
  position: "relative",
@@ -10516,7 +10680,7 @@ function AiTreeRenderer({
10516
10680
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10517
10681
  "div",
10518
10682
  {
10519
- "data-ai-row": "",
10683
+ "data-ai-columns": "",
10520
10684
  style: {
10521
10685
  display: "grid",
10522
10686
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11178,9 +11342,10 @@ function applyAiSectionsToDom(state, options) {
11178
11342
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11179
11343
  continue;
11180
11344
  }
11181
- const isNewMount = !existing || !existing.container.isConnected;
11182
11345
  let container = existing?.container;
11346
+ let isNewMount = false;
11183
11347
  if (!container || !container.isConnected) {
11348
+ isNewMount = true;
11184
11349
  existing?.root.unmount();
11185
11350
  container?.remove();
11186
11351
  container = document.createElement("div");
@@ -11518,6 +11683,34 @@ function minSpanForFooterBlock(type) {
11518
11683
  return 3;
11519
11684
  }
11520
11685
  }
11686
+ function readLiveSocialItems() {
11687
+ const root = getFooterRoot();
11688
+ const row = root?.querySelector("[data-ohw-socials-row]");
11689
+ if (!row) return [];
11690
+ const items = [];
11691
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11692
+ const href = anchor.getAttribute("href")?.trim() ?? "";
11693
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11694
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11695
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
11696
+ items.push({ platform, href });
11697
+ }
11698
+ return items;
11699
+ }
11700
+ function syncSocialRowsFromDom(tree) {
11701
+ const root = getFooterRoot();
11702
+ if (!root) return;
11703
+ const row = root.querySelector("[data-ohw-socials-row]");
11704
+ const live = readLiveSocialItems();
11705
+ if (row && live.length === 0) return;
11706
+ for (const col of tree.columns) {
11707
+ col.blocks = col.blocks.flatMap((block) => {
11708
+ if (block.type !== "social-row") return [block];
11709
+ if (!row) return [];
11710
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11711
+ });
11712
+ }
11713
+ }
11521
11714
  function collectBrandBlocks(tree) {
11522
11715
  const brand = [];
11523
11716
  for (const col of tree.columns) {
@@ -11763,12 +11956,13 @@ function textOf2(el) {
11763
11956
  }
11764
11957
  function syncFooterTreeLinksFromDom(tree) {
11765
11958
  const next = cloneTree(tree);
11959
+ syncSocialRowsFromDom(next);
11766
11960
  const domCols = listFooterColumns().map((col) => {
11767
11961
  const heading = getFooterColumnHeadingEl(col);
11768
11962
  const title = heading ? textOf2(heading) : void 0;
11769
11963
  const items = listFooterLinksInColumn(col).map((anchor) => {
11770
- const labelEl = anchor.querySelector('[data-ohw-editable="text"]');
11771
- const label = textOf2(labelEl) || textOf2(anchor);
11964
+ const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
11965
+ const label = textOf2(labelEl2) || textOf2(anchor);
11772
11966
  const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
11773
11967
  return label ? { label, href: href || "home" } : null;
11774
11968
  }).filter((x) => Boolean(x));
@@ -17467,7 +17661,7 @@ function apiBase() {
17467
17661
  function bridgeVersion() {
17468
17662
  try {
17469
17663
  if (true) {
17470
- return "0.1.161";
17664
+ return "0.1.163-next.434";
17471
17665
  }
17472
17666
  } catch {
17473
17667
  }
@@ -17481,7 +17675,7 @@ function stampBridgeVersionOnDocument() {
17481
17675
  return;
17482
17676
  }
17483
17677
  try {
17484
- const v = true ? "0.1.161" : "";
17678
+ const v = true ? "0.1.163-next.434" : "";
17485
17679
  if (v) {
17486
17680
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17487
17681
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18159,6 +18353,7 @@ function MediaOverlay({
18159
18353
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18160
18354
  );
18161
18355
  }, [isVideo]);
18356
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18162
18357
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18163
18358
  const box = {
18164
18359
  position: "fixed",
@@ -18257,11 +18452,10 @@ function MediaOverlay({
18257
18452
  className: "flex items-center justify-center cursor-pointer",
18258
18453
  style: {
18259
18454
  ...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",
18455
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18456
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18457
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18458
+ pointerEvents: "none",
18265
18459
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18266
18460
  // than hovered. Hover keeps the existing tinted preview.
18267
18461
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18288,17 +18482,17 @@ function MediaOverlay({
18288
18482
  },
18289
18483
  children: [
18290
18484
  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"
18485
+ replaceLabel
18292
18486
  ]
18293
18487
  }
18294
18488
  ),
18295
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18489
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18296
18490
  Button,
18297
18491
  {
18298
18492
  "data-ohw-media-overlay": "",
18299
18493
  variant: "outline",
18300
18494
  size: "sm",
18301
- "aria-label": isVideo ? "Replace video" : "Replace image",
18495
+ "aria-label": replaceLabel,
18302
18496
  className: "gap-1.5 cursor-pointer hover:bg-background",
18303
18497
  style: {
18304
18498
  ...OVERLAY_BUTTON_STYLE,
@@ -18321,7 +18515,7 @@ function MediaOverlay({
18321
18515
  },
18322
18516
  children: [
18323
18517
  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
18518
+ replaceMode === "full" ? replaceLabel : null
18325
18519
  ]
18326
18520
  }
18327
18521
  )
@@ -18915,7 +19109,7 @@ function AiSectionOverlay({
18915
19109
 
18916
19110
  // src/ui/ai-section/AiMediaStripOverlay.tsx
18917
19111
  var import_react12 = require("react");
18918
- var import_lucide_react8 = require("lucide-react");
19112
+ var import_lucide_react9 = require("lucide-react");
18919
19113
 
18920
19114
  // src/lib/ai-media-strip-tree.ts
18921
19115
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19029,14 +19223,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
19029
19223
  return true;
19030
19224
  });
19031
19225
  }
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
19226
  function setMediaStripItemLink(tree, index, link) {
19041
19227
  return withMediaStrip(tree, (block) => {
19042
19228
  const items = block.items;
@@ -19054,11 +19240,117 @@ function setMediaStripItemLink(tree, index, link) {
19054
19240
  });
19055
19241
  }
19056
19242
 
19057
- // src/ui/ai-section/AiMediaStripOverlay.tsx
19243
+ // src/ui/dialog.tsx
19244
+ var React9 = __toESM(require("react"), 1);
19245
+ var import_radix_ui6 = require("radix-ui");
19246
+ var import_lucide_react8 = require("lucide-react");
19058
19247
  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)`;
19248
+ function Dialog2({
19249
+ ...props
19250
+ }) {
19251
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
19252
+ }
19253
+ function DialogPortal({
19254
+ ...props
19255
+ }) {
19256
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
19257
+ }
19258
+ function DialogOverlay({
19259
+ className,
19260
+ ...props
19261
+ }) {
19262
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19263
+ import_radix_ui6.Dialog.Overlay,
19264
+ {
19265
+ "data-slot": "dialog-overlay",
19266
+ "data-ohw-link-modal-root": "",
19267
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19268
+ ...props
19269
+ }
19270
+ );
19271
+ }
19272
+ var DialogContent = React9.forwardRef(
19273
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19274
+ const positionMode = container ? "absolute" : "fixed";
19275
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
19276
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19277
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19278
+ import_radix_ui6.Dialog.Content,
19279
+ {
19280
+ ref,
19281
+ "data-slot": "dialog-content",
19282
+ className: cn(
19283
+ positionMode,
19284
+ "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",
19285
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19286
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19287
+ className
19288
+ ),
19289
+ onMouseDown: (e) => e.stopPropagation(),
19290
+ ...props,
19291
+ children: [
19292
+ children,
19293
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19294
+ import_radix_ui6.Dialog.Close,
19295
+ {
19296
+ type: "button",
19297
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19298
+ "aria-label": "Close",
19299
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
19300
+ }
19301
+ ) : null
19302
+ ]
19303
+ }
19304
+ )
19305
+ ] });
19306
+ }
19307
+ );
19308
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
19309
+ function DialogHeader({
19310
+ className,
19311
+ ...props
19312
+ }) {
19313
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19314
+ }
19315
+ function DialogFooter({
19316
+ className,
19317
+ ...props
19318
+ }) {
19319
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19320
+ "div",
19321
+ {
19322
+ className: cn("flex items-center justify-end gap-2", className),
19323
+ ...props
19324
+ }
19325
+ );
19326
+ }
19327
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19328
+ import_radix_ui6.Dialog.Title,
19329
+ {
19330
+ ref,
19331
+ className: cn(
19332
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19333
+ className
19334
+ ),
19335
+ ...props
19336
+ }
19337
+ ));
19338
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
19339
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19340
+ import_radix_ui6.Dialog.Description,
19341
+ {
19342
+ ref,
19343
+ className: cn("text-sm text-muted-foreground", className),
19344
+ ...props
19345
+ }
19346
+ ));
19347
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
19348
+ var DialogClose = import_radix_ui6.Dialog.Close;
19349
+
19350
+ // src/ui/ai-section/AiMediaStripOverlay.tsx
19351
+ var import_jsx_runtime21 = require("react/jsx-runtime");
19352
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19353
+ 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
19354
  function findMediaStripItemElement(sectionId, index) {
19063
19355
  const sectionEl = findByInstanceId(sectionId);
19064
19356
  if (!sectionEl) return null;
@@ -19068,14 +19360,35 @@ function findMediaStripItemElement(sectionId, index) {
19068
19360
  }
19069
19361
  return null;
19070
19362
  }
19071
- function readRect2(ref) {
19072
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19363
+ function itemRefFromTarget(target) {
19364
+ if (!(target instanceof Element)) return null;
19365
+ if (target.closest(CHROME_SELECTOR)) return null;
19366
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19367
+ if (!itemEl) return null;
19368
+ const sectionEl = itemEl.closest("[data-ohw-section]");
19369
+ const unit = sectionEl ? movableUnit(sectionEl) : null;
19370
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19371
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19372
+ if (!sectionId || Number.isNaN(index)) return null;
19373
+ return { sectionId, index };
19374
+ }
19375
+ function sameRef(a, b) {
19376
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19377
+ }
19378
+ function rectOf(el) {
19073
19379
  if (!el) return null;
19074
19380
  const r2 = el.getBoundingClientRect();
19075
19381
  if (r2.width <= 0 || r2.height <= 0) return null;
19076
19382
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19077
19383
  }
19078
- function useLiveItemRect(ref) {
19384
+ function readRect2(ref) {
19385
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19386
+ }
19387
+ function readStripRect(ref) {
19388
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19389
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19390
+ }
19391
+ function useLiveItemRect(ref, strip = false) {
19079
19392
  const [rect, setRect] = (0, import_react12.useState)(null);
19080
19393
  (0, import_react12.useEffect)(() => {
19081
19394
  if (!ref) {
@@ -19083,7 +19396,7 @@ function useLiveItemRect(ref) {
19083
19396
  return;
19084
19397
  }
19085
19398
  const update = () => {
19086
- const next = readRect2(ref);
19399
+ const next = strip ? readStripRect(ref) : readRect2(ref);
19087
19400
  setRect(
19088
19401
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19089
19402
  );
@@ -19098,9 +19411,49 @@ function useLiveItemRect(ref) {
19098
19411
  window.removeEventListener("resize", update);
19099
19412
  clearInterval(interval);
19100
19413
  };
19101
- }, [ref?.sectionId, ref?.index]);
19414
+ }, [ref?.sectionId, ref?.index, strip]);
19102
19415
  return rect;
19103
19416
  }
19417
+ var TOOLBAR_STRIP_GAP = 52;
19418
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19419
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19420
+ function StripToolbarSlot({ stripRect, children }) {
19421
+ const slotRef = (0, import_react12.useRef)(null);
19422
+ const [shift, setShift] = (0, import_react12.useState)(0);
19423
+ const centerX = stripRect.left + stripRect.width / 2;
19424
+ (0, import_react12.useLayoutEffect)(() => {
19425
+ const slot = slotRef.current;
19426
+ if (!slot) return;
19427
+ const clamp = () => {
19428
+ const w = slot.offsetWidth;
19429
+ if (w <= 0) return;
19430
+ const half = w / 2;
19431
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19432
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19433
+ };
19434
+ clamp();
19435
+ const ro = new ResizeObserver(clamp);
19436
+ ro.observe(slot);
19437
+ return () => ro.disconnect();
19438
+ }, [centerX, children]);
19439
+ const mobile = window.innerWidth <= 480;
19440
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19441
+ "div",
19442
+ {
19443
+ ref: slotRef,
19444
+ "data-ohw-bridge": "",
19445
+ "data-ohw-item-interaction": "",
19446
+ className: "pointer-events-auto fixed",
19447
+ style: {
19448
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19449
+ left: centerX + shift,
19450
+ transform: "translate(-50%, -100%)",
19451
+ zIndex: 2147483645
19452
+ },
19453
+ children
19454
+ }
19455
+ );
19456
+ }
19104
19457
  function requestValidateTree(postToParent2, tree) {
19105
19458
  return new Promise((resolve) => {
19106
19459
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19137,116 +19490,72 @@ function requestAssetPick(postToParent2) {
19137
19490
  postToParent2({ type: "ow:asset-pick", id });
19138
19491
  });
19139
19492
  }
19140
- function Pill({
19493
+ function ToolbarAction({
19141
19494
  label,
19142
19495
  onClick,
19143
- disabled,
19144
- active
19496
+ disabled = false,
19497
+ active = false,
19498
+ children
19145
19499
  }) {
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
- );
19500
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19501
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19502
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19503
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19504
+ ] });
19173
19505
  }
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",
19506
+ function ToolbarSeparator() {
19507
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19508
+ }
19509
+ function OptionMenu({
19510
+ label,
19511
+ value,
19512
+ options,
19513
+ onChange
19514
+ }) {
19515
+ const current = options.find((o) => o.value === value) ?? options[0];
19516
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19517
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
19518
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
19519
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19520
+ "button",
19521
+ {
19522
+ type: "button",
19523
+ "aria-label": label,
19524
+ 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",
19525
+ children: [
19526
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
19527
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
19528
+ ]
19529
+ }
19530
+ ) }),
19531
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19532
+ const selected = option.value === value;
19533
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19534
+ DropdownMenuItem,
19209
19535
  {
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
- );
19536
+ role: "menuitemradio",
19537
+ "aria-checked": selected,
19538
+ onSelect: () => onChange(option.value),
19539
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19540
+ children: [
19541
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
19542
+ selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
19543
+ ]
19544
+ },
19545
+ option.value
19546
+ );
19547
+ }) })
19548
+ ] })
19549
+ ] });
19241
19550
  }
19242
19551
  var VARIANTS = [
19243
19552
  { value: "logos", label: "Logos" },
19244
19553
  { value: "reel", label: "Reel" }
19245
19554
  ];
19246
19555
  var ALIGNS = [
19247
- { value: "left", label: "Left" },
19248
- { value: "center", label: "Center" },
19249
- { value: "right", label: "Right" }
19556
+ { value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
19557
+ { value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
19558
+ { value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
19250
19559
  ];
19251
19560
  var HOVERS = [
19252
19561
  { value: "none", label: "None" },
@@ -19254,104 +19563,104 @@ var HOVERS = [
19254
19563
  { value: "zoom", label: "Zoom" },
19255
19564
  { value: "fade", label: "Fade" }
19256
19565
  ];
19257
- var TREATMENTS = [
19258
- { value: "color", label: "Color" },
19259
- { value: "grayscale", label: "Grayscale" }
19260
- ];
19261
19566
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19262
- function LinkInput({ value, onCommit }) {
19263
- const [draft, setDraft] = (0, import_react12.useState)(value);
19567
+ function LinkModal({
19568
+ href,
19569
+ linkTarget,
19570
+ onClose,
19571
+ onSave
19572
+ }) {
19573
+ const [draft, setDraft] = (0, import_react12.useState)(href);
19574
+ const [newTab, setNewTab] = (0, import_react12.useState)(linkTarget !== "same-tab");
19264
19575
  const [invalid, setInvalid] = (0, import_react12.useState)(false);
19265
- (0, import_react12.useEffect)(() => {
19266
- setDraft(value);
19267
- setInvalid(false);
19268
- }, [value]);
19269
- const commit = () => {
19576
+ const save = () => {
19270
19577
  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: commit,
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
- ]
19578
+ if (next && !HTTP_URL_RE.test(next)) {
19579
+ setInvalid(true);
19580
+ return;
19340
19581
  }
19341
- );
19582
+ onSave(next, newTab ? "new-tab" : "same-tab");
19583
+ onClose();
19584
+ };
19585
+ 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: [
19586
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
19587
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
19588
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19589
+ "input",
19590
+ {
19591
+ autoFocus: true,
19592
+ type: "text",
19593
+ inputMode: "url",
19594
+ value: draft,
19595
+ onChange: (e) => {
19596
+ setDraft(e.target.value);
19597
+ setInvalid(false);
19598
+ },
19599
+ onKeyDown: (e) => {
19600
+ if (e.key === "Enter") save();
19601
+ },
19602
+ placeholder: "https://example.com",
19603
+ "aria-label": "Image link URL",
19604
+ "aria-invalid": invalid,
19605
+ className: cn(
19606
+ "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",
19607
+ invalid && "border-destructive focus:border-destructive"
19608
+ )
19609
+ }
19610
+ ),
19611
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19612
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19613
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19614
+ "Open in new tab"
19615
+ ] })
19616
+ ] }),
19617
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
19618
+ href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19619
+ "button",
19620
+ {
19621
+ type: "button",
19622
+ onClick: () => {
19623
+ onSave("", "new-tab");
19624
+ onClose();
19625
+ },
19626
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19627
+ children: "Remove link"
19628
+ }
19629
+ ),
19630
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19631
+ "button",
19632
+ {
19633
+ type: "button",
19634
+ onClick: onClose,
19635
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19636
+ children: "Cancel"
19637
+ }
19638
+ ),
19639
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19640
+ "button",
19641
+ {
19642
+ type: "button",
19643
+ onClick: save,
19644
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19645
+ children: "Save"
19646
+ }
19647
+ )
19648
+ ] })
19649
+ ] }) });
19342
19650
  }
19343
19651
  function MediaStripToolbar({
19344
19652
  entry,
19345
19653
  index,
19346
19654
  pending,
19347
19655
  error,
19656
+ itemEditOn,
19657
+ onToggleItemEdit,
19348
19658
  onSetVariant,
19349
19659
  onSetAlign,
19350
19660
  onSetHover,
19351
19661
  onSetTreatment,
19352
19662
  onResize,
19353
- onSetAlt,
19354
- onSetLink,
19663
+ onOpenLink,
19355
19664
  onAddItem,
19356
19665
  onRemoveItem,
19357
19666
  onChangeImage,
@@ -19360,81 +19669,102 @@ function MediaStripToolbar({
19360
19669
  }) {
19361
19670
  const items = mediaStripItems(entry.tree);
19362
19671
  const itemCount = items.length;
19363
- const currentAlt = items[index]?.alt ?? "";
19364
- const currentHref = items[index]?.href ?? "";
19365
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19366
19672
  const slots = findMediaStripSlots(entry.tree);
19367
19673
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19368
19674
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19369
19675
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19370
19676
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19371
19677
  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)(
19678
+ const mobile = window.innerWidth <= 480;
19679
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19680
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19384
19681
  "div",
19385
19682
  {
19386
19683
  "data-ohw-bridge": "",
19387
19684
  "data-ohw-toolbar": "",
19388
19685
  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
- },
19686
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19687
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19402
19688
  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: currentHref, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19421
- currentHref && /* @__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(currentHref, "new-tab") }),
19423
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref, "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 })
19689
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19690
+ "div",
19691
+ {
19692
+ className: cn(
19693
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19694
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19695
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
19696
+ ),
19697
+ children: [
19698
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19699
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19700
+ CustomToolbarButton,
19701
+ {
19702
+ type: "button",
19703
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19704
+ "aria-pressed": itemEditOn,
19705
+ onClick: onToggleItemEdit,
19706
+ className: "group size-8",
19707
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19708
+ import_lucide_react9.Star,
19709
+ {
19710
+ size: 16,
19711
+ fill: "currentColor",
19712
+ strokeWidth: 0,
19713
+ className: cn(
19714
+ "transition-colors",
19715
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19716
+ ),
19717
+ style: { pointerEvents: "none" }
19718
+ }
19719
+ )
19720
+ }
19721
+ ) }),
19722
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19723
+ ] }),
19724
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19725
+ /* @__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" } }) }),
19726
+ /* @__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" } }) }),
19727
+ /* @__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" } }) }),
19728
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19729
+ ToolbarAction,
19730
+ {
19731
+ label: gatedLabel("Move right"),
19732
+ onClick: onMoveRight,
19733
+ disabled: !itemEditOn || index >= itemCount - 1,
19734
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
19735
+ }
19736
+ ),
19737
+ /* @__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" } }) }),
19738
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19739
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19740
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19741
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19742
+ ToolbarAction,
19743
+ {
19744
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19745
+ active: treatment === "grayscale",
19746
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19747
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
19748
+ }
19749
+ ),
19750
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19751
+ 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)),
19752
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19753
+ /* @__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" } }) }),
19754
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19755
+ sizeValue,
19756
+ "px"
19757
+ ] }),
19758
+ /* @__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" } }) }),
19759
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19760
+ /* @__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" } }) })
19761
+ ]
19762
+ }
19763
+ ),
19764
+ 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
19765
  ]
19436
19766
  }
19437
- );
19767
+ ) });
19438
19768
  }
19439
19769
  function findMediaStripSlots(tree) {
19440
19770
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19453,31 +19783,23 @@ function AiMediaStripOverlay({
19453
19783
  }) {
19454
19784
  const [hover, setHover] = (0, import_react12.useState)(null);
19455
19785
  const [active, setActive] = (0, import_react12.useState)(null);
19786
+ const [itemEditOn, setItemEditOn] = (0, import_react12.useState)(false);
19787
+ const [linkOpen, setLinkOpen] = (0, import_react12.useState)(false);
19456
19788
  const [pending, setPending] = (0, import_react12.useState)(false);
19457
19789
  const [error, setError] = (0, import_react12.useState)(null);
19458
19790
  const activeRef = (0, import_react12.useRef)(null);
19459
19791
  activeRef.current = active;
19792
+ const linkOpenRef = (0, import_react12.useRef)(false);
19793
+ linkOpenRef.current = linkOpen;
19460
19794
  (0, import_react12.useEffect)(() => {
19461
19795
  const onMove = (e) => {
19796
+ const ref = itemRefFromTarget(e.target);
19462
19797
  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 });
19798
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19799
+ setHover((prev) => {
19800
+ const next = ref && !overEditable ? ref : null;
19801
+ return sameRef(prev, next) ? prev : next;
19802
+ });
19481
19803
  };
19482
19804
  const onLeave = () => setHover(null);
19483
19805
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19489,23 +19811,25 @@ function AiMediaStripOverlay({
19489
19811
  }, []);
19490
19812
  (0, import_react12.useEffect)(() => {
19491
19813
  const onClick = (e) => {
19492
- const current = activeRef.current;
19493
- if (!current) return;
19494
19814
  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);
19815
+ if (!(t instanceof Element)) return;
19816
+ if (t.closest(CHROME_SELECTOR)) return;
19817
+ const ref = itemRefFromTarget(t);
19818
+ if (sameRef(activeRef.current, ref)) return;
19819
+ if (ref) clearInteractionChromeRef.current();
19820
+ setItemEditOn(false);
19500
19821
  setError(null);
19822
+ setActive(ref);
19501
19823
  };
19502
19824
  document.addEventListener("click", onClick, true);
19503
19825
  return () => document.removeEventListener("click", onClick, true);
19504
- }, []);
19826
+ }, [clearInteractionChromeRef]);
19505
19827
  (0, import_react12.useEffect)(() => {
19506
19828
  const onBlur = () => {
19507
19829
  if (!activeRef.current) return;
19508
19830
  setActive(null);
19831
+ setItemEditOn(false);
19832
+ setLinkOpen(false);
19509
19833
  setError(null);
19510
19834
  };
19511
19835
  window.addEventListener("blur", onBlur);
@@ -19515,7 +19839,10 @@ function AiMediaStripOverlay({
19515
19839
  const onKeyDown = (e) => {
19516
19840
  if (e.key !== "Escape") return;
19517
19841
  if (!activeRef.current) return;
19842
+ if (linkOpenRef.current) return;
19843
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19518
19844
  setActive(null);
19845
+ setItemEditOn(false);
19519
19846
  setError(null);
19520
19847
  };
19521
19848
  document.addEventListener("keydown", onKeyDown);
@@ -19549,137 +19876,133 @@ function AiMediaStripOverlay({
19549
19876
  tree: nextTree,
19550
19877
  label: entry.label,
19551
19878
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19552
- ...entry.brand ? { brand: entry.brand } : {}
19879
+ ...entry.brand ? { brand: entry.brand } : {},
19880
+ // The user is already looking at the strip they just edited — recentering the viewport
19881
+ // on every edit reads as the section jumping around.
19882
+ skipScrollIntoView: true
19553
19883
  });
19554
19884
  return true;
19555
19885
  },
19556
19886
  [findEntry, postToParent2, applyTreeLocalRef]
19557
19887
  );
19558
19888
  const activeEntry = active ? findEntry(active.sectionId) : null;
19559
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19560
19889
  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) => {
19890
+ const activeStripRect = useLiveItemRect(active, true);
19891
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
19892
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
19893
+ const activeItem = active ? activeItems[active.index] : void 0;
19894
+ const activeHref = activeItem?.href ?? "";
19895
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19896
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
19897
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19898
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
19899
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
19900
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19901
+ MediaStripToolbar,
19902
+ {
19903
+ entry: activeEntry,
19904
+ index: active.index,
19905
+ pending,
19906
+ error,
19907
+ itemEditOn,
19908
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
19909
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19910
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19911
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19912
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19913
+ onResize: (delta) => {
19914
+ const slots = findMediaStripSlots(activeEntry.tree);
19915
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19916
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19917
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19918
+ },
19919
+ onOpenLink: () => setLinkOpen(true),
19920
+ onAddItem: () => {
19921
+ void requestAssetPick(postToParent2).then((picked) => {
19922
+ if (!picked) return;
19923
+ const item = { assetId: picked.assetId, alt: "Logo" };
19621
19924
  void runMutation(
19622
19925
  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
- });
19637
- });
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
- );
19926
+ (tree) => addMediaStripItem(tree, item, active.index),
19927
+ { [picked.assetId]: picked.url }
19928
+ ).then((applied) => {
19929
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19647
19930
  });
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
- }
19931
+ });
19932
+ },
19933
+ onChangeImage: () => {
19934
+ void requestAssetPick(postToParent2).then((picked) => {
19935
+ if (!picked) return;
19936
+ void runMutation(
19937
+ active.sectionId,
19938
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19939
+ { [picked.assetId]: picked.url }
19668
19940
  );
19669
- }
19941
+ });
19942
+ },
19943
+ onRemoveItem: () => {
19944
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19945
+ (applied) => {
19946
+ if (applied) setActive(null);
19947
+ }
19948
+ );
19949
+ },
19950
+ onMoveLeft: () => {
19951
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19952
+ (applied) => {
19953
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19954
+ }
19955
+ );
19956
+ },
19957
+ onMoveRight: () => {
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
+ );
19670
19963
  }
19671
- )
19672
- }
19673
- )
19964
+ }
19965
+ ) }),
19966
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19967
+ "div",
19968
+ {
19969
+ "data-ohw-bridge": "",
19970
+ "data-ohw-item-interaction": "",
19971
+ "aria-hidden": true,
19972
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
19973
+ style: {
19974
+ top: activeItemRect.top + activeItemRect.height + 10,
19975
+ left: activeItemRect.left - 5,
19976
+ background: PRIMARY3,
19977
+ zIndex: 2147483644
19978
+ },
19979
+ children: "Media item"
19980
+ }
19981
+ ),
19982
+ linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19983
+ LinkModal,
19984
+ {
19985
+ href: activeHref,
19986
+ linkTarget: activeTarget,
19987
+ onClose: () => setLinkOpen(false),
19988
+ onSave: (href, linkTarget) => {
19989
+ void runMutation(
19990
+ active.sectionId,
19991
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19992
+ );
19993
+ }
19994
+ }
19995
+ )
19996
+ ] })
19674
19997
  ] });
19675
19998
  }
19676
19999
 
19677
20000
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19678
20001
  var import_react13 = require("react");
19679
- var import_lucide_react9 = require("lucide-react");
19680
- var import_jsx_runtime21 = require("react/jsx-runtime");
20002
+ var import_lucide_react10 = require("lucide-react");
20003
+ var import_jsx_runtime22 = require("react/jsx-runtime");
19681
20004
  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]";
20005
+ 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
20006
  function findPricingCardElement(sectionId, index) {
19684
20007
  const sectionEl = findByInstanceId(sectionId);
19685
20008
  if (!sectionEl) return null;
@@ -19691,7 +20014,7 @@ function findPricingCardElement(sectionId, index) {
19691
20014
  }
19692
20015
  function cardRefFromTarget(target) {
19693
20016
  if (!(target instanceof Element)) return null;
19694
- if (target.closest(CHROME_SELECTOR)) return null;
20017
+ if (target.closest(CHROME_SELECTOR2)) return null;
19695
20018
  const cardEl = target.closest("[data-ohw-pricing-card]");
19696
20019
  if (!cardEl) return null;
19697
20020
  const sectionEl = cardEl.closest("[data-ohw-section]");
@@ -19701,21 +20024,21 @@ function cardRefFromTarget(target) {
19701
20024
  if (!sectionId || Number.isNaN(index)) return null;
19702
20025
  return { sectionId, index };
19703
20026
  }
19704
- function sameRef(a, b) {
20027
+ function sameRef2(a, b) {
19705
20028
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19706
20029
  }
19707
- function rectOf(el) {
20030
+ function rectOf2(el) {
19708
20031
  if (!el) return null;
19709
20032
  const r2 = el.getBoundingClientRect();
19710
20033
  if (r2.width <= 0 || r2.height <= 0) return null;
19711
20034
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19712
20035
  }
19713
20036
  function readRect3(ref) {
19714
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20037
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19715
20038
  }
19716
20039
  function readGridRect(ref) {
19717
20040
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19718
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20041
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19719
20042
  }
19720
20043
  function useLiveCardRect(ref, grid = false) {
19721
20044
  const [rect, setRect] = (0, import_react13.useState)(null);
@@ -19745,7 +20068,7 @@ function useLiveCardRect(ref, grid = false) {
19745
20068
  }
19746
20069
  var TOOLBAR_GRID_GAP = 52;
19747
20070
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19748
- var TOOLBAR_EDGE_MARGIN2 = 4;
20071
+ var TOOLBAR_EDGE_MARGIN3 = 4;
19749
20072
  function GridToolbarSlot({ gridRect, children }) {
19750
20073
  const slotRef = (0, import_react13.useRef)(null);
19751
20074
  const [shift, setShift] = (0, import_react13.useState)(0);
@@ -19757,7 +20080,7 @@ function GridToolbarSlot({ gridRect, children }) {
19757
20080
  const w = slot.offsetWidth;
19758
20081
  if (w <= 0) return;
19759
20082
  const half = w / 2;
19760
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20083
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19761
20084
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19762
20085
  };
19763
20086
  clamp();
@@ -19766,7 +20089,7 @@ function GridToolbarSlot({ gridRect, children }) {
19766
20089
  return () => ro.disconnect();
19767
20090
  }, [centerX, children]);
19768
20091
  const mobile = window.innerWidth <= 480;
19769
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20092
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19770
20093
  "div",
19771
20094
  {
19772
20095
  ref: slotRef,
@@ -19801,7 +20124,7 @@ function requestValidateTree2(postToParent2, tree) {
19801
20124
  });
19802
20125
  }
19803
20126
  function StyleSwatch({ style }) {
19804
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20127
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19805
20128
  "span",
19806
20129
  {
19807
20130
  "aria-hidden": true,
@@ -19815,35 +20138,35 @@ function StyleSwatch({ style }) {
19815
20138
  );
19816
20139
  }
19817
20140
  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" })
20141
+ 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: [
20142
+ /* @__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" }),
20143
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19821
20144
  ] });
19822
20145
  }
19823
20146
  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" })
20147
+ 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: [
20148
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20149
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20150
+ /* @__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" }),
20151
+ /* @__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" }),
20152
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20153
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19831
20154
  ] });
19832
20155
  }
19833
- function ToolbarAction({
20156
+ function ToolbarAction2({
19834
20157
  label,
19835
20158
  onClick,
19836
20159
  disabled = false,
19837
20160
  children
19838
20161
  }) {
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 })
20162
+ const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20163
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20164
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
20165
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19843
20166
  ] });
19844
20167
  }
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" });
20168
+ function ToolbarSeparator2() {
20169
+ 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
20170
  }
19848
20171
  function CardStyleMenu({
19849
20172
  value,
@@ -19851,7 +20174,7 @@ function CardStyleMenu({
19851
20174
  disabled = false
19852
20175
  }) {
19853
20176
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
19854
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20177
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19855
20178
  "button",
19856
20179
  {
19857
20180
  type: "button",
@@ -19862,28 +20185,28 @@ function CardStyleMenu({
19862
20185
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
19863
20186
  ),
19864
20187
  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" } })
20188
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
20189
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20190
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
19868
20191
  ]
19869
20192
  }
19870
20193
  );
19871
20194
  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" })
20195
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20196
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20197
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20198
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
20199
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
19877
20200
  ] })
19878
20201
  ] });
19879
20202
  }
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) => {
20203
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20204
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20205
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
20206
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20207
+ /* @__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
20208
  const selected = style.value === value;
19886
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20209
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19887
20210
  DropdownMenuItem,
19888
20211
  {
19889
20212
  role: "menuitemradio",
@@ -19891,9 +20214,9 @@ function CardStyleMenu({
19891
20214
  onSelect: () => onChange(style.value),
19892
20215
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19893
20216
  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" })
20217
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
20218
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
20219
+ selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
19897
20220
  ]
19898
20221
  },
19899
20222
  style.value
@@ -19923,7 +20246,7 @@ function PricingCardToolbar({
19923
20246
  const style = pricingCardStyle(entry.tree, index);
19924
20247
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
19925
20248
  const mobile = window.innerWidth <= 480;
19926
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20249
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19927
20250
  "div",
19928
20251
  {
19929
20252
  "data-ohw-bridge": "",
@@ -19935,7 +20258,7 @@ function PricingCardToolbar({
19935
20258
  ),
19936
20259
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19937
20260
  children: [
19938
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20261
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19939
20262
  "div",
19940
20263
  {
19941
20264
  className: cn(
@@ -19944,8 +20267,8 @@ function PricingCardToolbar({
19944
20267
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
19945
20268
  ),
19946
20269
  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)(
20270
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20271
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19949
20272
  CustomToolbarButton,
19950
20273
  {
19951
20274
  type: "button",
@@ -19953,8 +20276,8 @@ function PricingCardToolbar({
19953
20276
  "aria-pressed": featuredTag,
19954
20277
  onClick: () => onSetFeaturedTag(!featuredTag),
19955
20278
  className: "group size-8",
19956
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19957
- import_lucide_react9.Star,
20279
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20280
+ import_lucide_react10.Star,
19958
20281
  {
19959
20282
  size: 16,
19960
20283
  fill: "currentColor",
@@ -19968,25 +20291,25 @@ function PricingCardToolbar({
19968
20291
  )
19969
20292
  }
19970
20293
  ) }),
19971
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20294
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
19972
20295
  ] }),
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" })
20296
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20297
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20298
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20299
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
20300
+ /* @__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: [
20301
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
20302
+ /* @__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
20303
  ] }) }),
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" } }) })
20304
+ /* @__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" }) }),
20305
+ /* @__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" }) }),
20306
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20307
+ /* @__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" } }) }),
20308
+ /* @__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
20309
  ]
19987
20310
  }
19988
20311
  ),
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 })
20312
+ 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
20313
  ]
19991
20314
  }
19992
20315
  ) });
@@ -20020,7 +20343,7 @@ function AiPricingCardOverlay({
20020
20343
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20021
20344
  setHover((prev) => {
20022
20345
  const next = ref && !overEditable ? ref : null;
20023
- return sameRef(prev, next) ? prev : next;
20346
+ return sameRef2(prev, next) ? prev : next;
20024
20347
  });
20025
20348
  };
20026
20349
  const onLeave = () => setHover(null);
@@ -20035,10 +20358,10 @@ function AiPricingCardOverlay({
20035
20358
  const onClick = (e) => {
20036
20359
  const t = e.target;
20037
20360
  if (!(t instanceof Element)) return;
20038
- if (t.closest(CHROME_SELECTOR)) return;
20361
+ if (t.closest(CHROME_SELECTOR2)) return;
20039
20362
  const ref = cardRefFromTarget(t);
20040
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
20041
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20363
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20364
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20042
20365
  };
20043
20366
  document.addEventListener("click", onClick, true);
20044
20367
  return () => document.removeEventListener("click", onClick, true);
@@ -20103,12 +20426,12 @@ function AiPricingCardOverlay({
20103
20426
  const activeEntry = active ? findEntry(active.sectionId) : null;
20104
20427
  const activeCardRect = useLiveCardRect(active);
20105
20428
  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)(
20429
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20430
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20431
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20432
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20433
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20434
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20112
20435
  PricingCardToolbar,
20113
20436
  {
20114
20437
  entry: activeEntry,
@@ -20136,7 +20459,7 @@ function AiPricingCardOverlay({
20136
20459
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20137
20460
  }
20138
20461
  ) }),
20139
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20462
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20140
20463
  "div",
20141
20464
  {
20142
20465
  "data-ohw-bridge": "",
@@ -20158,7 +20481,7 @@ function AiPricingCardOverlay({
20158
20481
 
20159
20482
  // src/ui/ai-section/AiVideoOverlay.tsx
20160
20483
  var import_react14 = require("react");
20161
- var import_lucide_react10 = require("lucide-react");
20484
+ var import_lucide_react11 = require("lucide-react");
20162
20485
 
20163
20486
  // src/lib/ai-video-tree.ts
20164
20487
  function resolveVideoBlock(tree, path) {
@@ -20200,39 +20523,11 @@ function clearVideo(tree, path) {
20200
20523
  });
20201
20524
  }
20202
20525
 
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
20526
  // src/ui/ai-section/AiVideoOverlay.tsx
20232
- var import_jsx_runtime22 = require("react/jsx-runtime");
20527
+ var import_jsx_runtime23 = require("react/jsx-runtime");
20233
20528
  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)`;
20529
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20530
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20236
20531
  function findVideoBlockElement(sectionId, path) {
20237
20532
  const sectionEl = findByInstanceId(sectionId);
20238
20533
  if (!sectionEl) return null;
@@ -20292,12 +20587,12 @@ function requestValidateTree3(postToParent2, tree) {
20292
20587
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20293
20588
  });
20294
20589
  }
20295
- function Pill2({
20590
+ function Pill({
20296
20591
  label,
20297
20592
  onClick,
20298
20593
  disabled
20299
20594
  }) {
20300
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20595
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20301
20596
  "button",
20302
20597
  {
20303
20598
  type: "button",
@@ -20313,7 +20608,7 @@ function Pill2({
20313
20608
  border: "none",
20314
20609
  cursor: disabled ? "default" : "pointer",
20315
20610
  background: "#ffffff",
20316
- color: OHW_BLUE_DARK2,
20611
+ color: OHW_BLUE_DARK,
20317
20612
  opacity: disabled ? 0.4 : 1,
20318
20613
  fontSize: 12,
20319
20614
  lineHeight: "16px",
@@ -20335,7 +20630,7 @@ function VideoUrlInput({ value, onCommit }) {
20335
20630
  setDraft(value ? watchUrl(value) : "");
20336
20631
  setInvalid(false);
20337
20632
  }, [value]);
20338
- const commit = () => {
20633
+ const commit2 = () => {
20339
20634
  const next = draft.trim();
20340
20635
  if (!next) {
20341
20636
  setInvalid(false);
@@ -20356,8 +20651,8 @@ function VideoUrlInput({ value, onCommit }) {
20356
20651
  onCommit(id);
20357
20652
  }
20358
20653
  };
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)(
20654
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20655
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20361
20656
  "div",
20362
20657
  {
20363
20658
  style: {
@@ -20373,12 +20668,12 @@ function VideoUrlInput({ value, onCommit }) {
20373
20668
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20374
20669
  },
20375
20670
  children: [
20376
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20671
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20377
20672
  "span",
20378
20673
  {
20379
20674
  style: {
20380
20675
  flex: "0 0 auto",
20381
- color: OHW_BLUE_DARK2,
20676
+ color: OHW_BLUE_DARK,
20382
20677
  fontSize: 10,
20383
20678
  lineHeight: "16px",
20384
20679
  fontWeight: 700,
@@ -20388,14 +20683,14 @@ function VideoUrlInput({ value, onCommit }) {
20388
20683
  children: "Video"
20389
20684
  }
20390
20685
  ),
20391
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20686
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20392
20687
  "input",
20393
20688
  {
20394
20689
  type: "text",
20395
20690
  inputMode: "url",
20396
20691
  value: draft,
20397
20692
  onChange: (e) => handleChange(e.target.value),
20398
- onBlur: commit,
20693
+ onBlur: commit2,
20399
20694
  onKeyDown: (e) => {
20400
20695
  if (e.key === "Enter") e.currentTarget.blur();
20401
20696
  if (e.key === "Escape") {
@@ -20425,7 +20720,7 @@ function VideoUrlInput({ value, onCommit }) {
20425
20720
  ]
20426
20721
  }
20427
20722
  ),
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." })
20723
+ 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
20724
  ] });
20430
20725
  }
20431
20726
  function VideoToolbar({
@@ -20435,7 +20730,7 @@ function VideoToolbar({
20435
20730
  onSetVideoId,
20436
20731
  onRemove
20437
20732
  }) {
20438
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20733
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20439
20734
  "div",
20440
20735
  {
20441
20736
  "data-ohw-bridge": "",
@@ -20447,7 +20742,7 @@ function VideoToolbar({
20447
20742
  gap: 6,
20448
20743
  alignItems: "center",
20449
20744
  width: 280,
20450
- background: OHW_BLUE2,
20745
+ background: OHW_BLUE,
20451
20746
  padding: 8,
20452
20747
  borderRadius: 12,
20453
20748
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20455,9 +20750,9 @@ function VideoToolbar({
20455
20750
  opacity: pending ? 0.6 : 1
20456
20751
  },
20457
20752
  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 })
20753
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20754
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20755
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20461
20756
  ]
20462
20757
  }
20463
20758
  );
@@ -20577,8 +20872,8 @@ function AiVideoOverlay({
20577
20872
  const activeBlockRect = useLiveBlockRect(active);
20578
20873
  const TOOLBAR_APPROX_H = 90;
20579
20874
  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)(
20875
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
20876
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20582
20877
  "button",
20583
20878
  {
20584
20879
  type: "button",
@@ -20606,15 +20901,15 @@ function AiVideoOverlay({
20606
20901
  fontSize: 14,
20607
20902
  fontWeight: 700
20608
20903
  },
20609
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
20904
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
20610
20905
  }
20611
20906
  ),
20612
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20907
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20613
20908
  ItemInteractionLayer,
20614
20909
  {
20615
20910
  rect: activeBlockRect,
20616
20911
  state: toolbarState,
20617
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20912
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20618
20913
  VideoToolbar,
20619
20914
  {
20620
20915
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20638,7 +20933,7 @@ function AiVideoOverlay({
20638
20933
 
20639
20934
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20640
20935
  var import_react15 = require("react");
20641
- var import_lucide_react11 = require("lucide-react");
20936
+ var import_lucide_react12 = require("lucide-react");
20642
20937
 
20643
20938
  // src/lib/ai-carousel-tree.ts
20644
20939
  function isCarouselBlock(node) {
@@ -20689,10 +20984,10 @@ function setCarouselAutoplay(tree, on) {
20689
20984
  }
20690
20985
 
20691
20986
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20692
- var import_jsx_runtime23 = require("react/jsx-runtime");
20987
+ var import_jsx_runtime24 = require("react/jsx-runtime");
20693
20988
  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)`;
20989
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
20990
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20696
20991
  function findCarouselItemElement(sectionId, index) {
20697
20992
  const sectionEl = findByInstanceId(sectionId);
20698
20993
  if (!sectionEl) return null;
@@ -20771,8 +21066,8 @@ function requestAssetPick2(postToParent2) {
20771
21066
  postToParent2({ type: "ow:asset-pick", id });
20772
21067
  });
20773
21068
  }
20774
- function Pill3({ label, onClick, disabled }) {
20775
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21069
+ function Pill2({ label, onClick, disabled }) {
21070
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20776
21071
  "button",
20777
21072
  {
20778
21073
  type: "button",
@@ -20788,7 +21083,7 @@ function Pill3({ label, onClick, disabled }) {
20788
21083
  border: "none",
20789
21084
  cursor: disabled ? "default" : "pointer",
20790
21085
  background: "#ffffff",
20791
- color: OHW_BLUE_DARK3,
21086
+ color: OHW_BLUE_DARK2,
20792
21087
  opacity: disabled ? 0.4 : 1,
20793
21088
  fontSize: 12,
20794
21089
  lineHeight: "16px",
@@ -20806,7 +21101,7 @@ function TogglePill({
20806
21101
  onToggle,
20807
21102
  disabled
20808
21103
  }) {
20809
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21104
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
20810
21105
  "button",
20811
21106
  {
20812
21107
  type: "button",
@@ -20825,7 +21120,7 @@ function TogglePill({
20825
21120
  border: "none",
20826
21121
  cursor: disabled ? "default" : "pointer",
20827
21122
  background: "#ffffff",
20828
- color: OHW_BLUE_DARK3,
21123
+ color: OHW_BLUE_DARK2,
20829
21124
  opacity: disabled ? 0.4 : 1,
20830
21125
  fontSize: 12,
20831
21126
  lineHeight: "16px",
@@ -20835,7 +21130,7 @@ function TogglePill({
20835
21130
  },
20836
21131
  children: [
20837
21132
  label,
20838
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21133
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20839
21134
  "span",
20840
21135
  {
20841
21136
  "aria-hidden": true,
@@ -20848,10 +21143,10 @@ function TogglePill({
20848
21143
  // Off is a grey track, not a washed-out blue: the pill's own white background already
20849
21144
  // carries the brand colour in the text, and a pale blue track next to it read as
20850
21145
  // "disabled control" rather than "switch that is off".
20851
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21146
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20852
21147
  transition: "background 120ms ease"
20853
21148
  },
20854
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21149
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20855
21150
  "span",
20856
21151
  {
20857
21152
  style: {
@@ -20880,7 +21175,7 @@ function CarouselSlideToolbar({
20880
21175
  onChangeImage,
20881
21176
  onToggleAutoplay
20882
21177
  }) {
20883
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21178
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
20884
21179
  "div",
20885
21180
  {
20886
21181
  "data-ohw-bridge": "",
@@ -20891,7 +21186,7 @@ function CarouselSlideToolbar({
20891
21186
  flexDirection: "column",
20892
21187
  gap: 6,
20893
21188
  alignItems: "center",
20894
- background: OHW_BLUE3,
21189
+ background: OHW_BLUE2,
20895
21190
  padding: 8,
20896
21191
  borderRadius: 12,
20897
21192
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20903,11 +21198,11 @@ function CarouselSlideToolbar({
20903
21198
  pointerEvents: pending ? "none" : "auto"
20904
21199
  },
20905
21200
  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 })
21201
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21202
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
21203
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
20909
21204
  ] }),
20910
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21205
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20911
21206
  ]
20912
21207
  }
20913
21208
  );
@@ -21047,8 +21342,8 @@ function AiFadeCarouselOverlay({
21047
21342
  const activeItemRect = useLiveItemRect2(active);
21048
21343
  const TOOLBAR_APPROX_H = 90;
21049
21344
  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)(
21345
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
21346
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21052
21347
  "button",
21053
21348
  {
21054
21349
  type: "button",
@@ -21077,10 +21372,10 @@ function AiFadeCarouselOverlay({
21077
21372
  fontSize: 14,
21078
21373
  fontWeight: 700
21079
21374
  },
21080
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
21375
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
21081
21376
  }
21082
21377
  ),
21083
- swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21378
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21084
21379
  "div",
21085
21380
  {
21086
21381
  ref: skeletonRef,
@@ -21098,15 +21393,15 @@ function AiFadeCarouselOverlay({
21098
21393
  zIndex: 2147483646,
21099
21394
  pointerEvents: "none"
21100
21395
  },
21101
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
21396
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
21102
21397
  }
21103
21398
  ),
21104
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21399
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21105
21400
  ItemInteractionLayer,
21106
21401
  {
21107
21402
  rect: activeItemRect,
21108
21403
  state: toolbarState,
21109
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21404
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21110
21405
  CarouselSlideToolbar,
21111
21406
  {
21112
21407
  pending,
@@ -21297,113 +21592,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21297
21592
  // src/ui/link-modal/LinkPopover.tsx
21298
21593
  var import_react19 = require("react");
21299
21594
 
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
21595
  // src/ui/link-modal/LinkEditorPanel.tsx
21408
21596
  var import_lucide_react16 = require("lucide-react");
21409
21597
 
@@ -22507,6 +22695,7 @@ function shouldUseDevFixtures() {
22507
22695
  function getLogoElement(el) {
22508
22696
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22509
22697
  if (marked) return marked;
22698
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22510
22699
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22511
22700
  if (!root) return null;
22512
22701
  const anchor = el.closest("a");
@@ -24201,6 +24390,234 @@ function deleteSelectedNavFooterItem(deps) {
24201
24390
  return false;
24202
24391
  }
24203
24392
 
24393
+ // src/lib/build-page-sync.ts
24394
+ var import_react23 = require("react");
24395
+ var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
24396
+ function normalisePath(path) {
24397
+ const trimmed = path.trim().replace(/[?#].*$/u, "");
24398
+ if (!trimmed || trimmed === "/") return "/";
24399
+ return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
24400
+ }
24401
+ function isDeadPageHref(href, livePaths) {
24402
+ const value = href.trim();
24403
+ if (!value.startsWith("/") || value.startsWith("//")) return false;
24404
+ const path = normalisePath(value);
24405
+ if (path === "/") return false;
24406
+ return !livePaths.some((live) => {
24407
+ const p = normalisePath(live);
24408
+ return p === path || p !== "/" && path.startsWith(`${p}/`);
24409
+ });
24410
+ }
24411
+ var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
24412
+ function planBuildPageSync(links, msg) {
24413
+ const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
24414
+ const removed = new Set((msg.removed ?? []).map(normalisePath));
24415
+ const remove = [];
24416
+ const relabel = [];
24417
+ const retarget = [];
24418
+ const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
24419
+ for (const link of links) {
24420
+ const href = link.href.trim();
24421
+ const isPage = href.startsWith("/") && !href.startsWith("//");
24422
+ if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
24423
+ if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
24424
+ else remove.push(link.hrefKey);
24425
+ continue;
24426
+ }
24427
+ if (isPage) {
24428
+ const path = normalisePath(href);
24429
+ const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
24430
+ if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
24431
+ relabel.push({ hrefKey: link.hrefKey, label: rename.label });
24432
+ }
24433
+ continue;
24434
+ }
24435
+ if (href.startsWith("#") || href.startsWith("/#")) {
24436
+ const anchor = href.replace(/^\/?#/u, "").toLowerCase();
24437
+ const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
24438
+ if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
24439
+ relabel.push({ hrefKey: link.hrefKey, label: target.label });
24440
+ }
24441
+ }
24442
+ }
24443
+ return { remove, relabel, retarget };
24444
+ }
24445
+ function linkHref(el) {
24446
+ const key = el.getAttribute("data-ohw-href-key");
24447
+ const stored = key ? getStoredLinkHref(key) : void 0;
24448
+ return stored ?? el.getAttribute("href") ?? "";
24449
+ }
24450
+ function labelEl(anchor) {
24451
+ return anchor.querySelector('[data-ohw-editable="text"]');
24452
+ }
24453
+ function collectLinks() {
24454
+ const seen = /* @__PURE__ */ new Set();
24455
+ const links = [];
24456
+ document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
24457
+ const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
24458
+ if (seen.has(hrefKey)) return;
24459
+ const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
24460
+ if (!area) return;
24461
+ const label = labelEl(el);
24462
+ if (!label && area !== "chrome") return;
24463
+ seen.add(hrefKey);
24464
+ links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
24465
+ });
24466
+ return links;
24467
+ }
24468
+ function applyBuildPageSync(msg, deps) {
24469
+ const plan = planBuildPageSync(collectLinks(), msg);
24470
+ const nodes = /* @__PURE__ */ new Map();
24471
+ for (const hrefKey of plan.remove) {
24472
+ const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
24473
+ if (!anchor) continue;
24474
+ const nav = isNavbarHrefKey(hrefKey);
24475
+ const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
24476
+ if (!result) continue;
24477
+ for (const key of result.removedKeys) {
24478
+ nodes.set(key, "");
24479
+ clearStoredLinkHref(key);
24480
+ }
24481
+ nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
24482
+ }
24483
+ for (const { hrefKey, label } of plan.relabel) {
24484
+ const labelKey = hrefKey.replace(/-href$/u, "-label");
24485
+ document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
24486
+ const el = labelEl(anchor);
24487
+ if (el) el.textContent = label;
24488
+ });
24489
+ nodes.set(labelKey, label);
24490
+ }
24491
+ for (const { hrefKey, href } of plan.retarget) {
24492
+ setStoredLinkHref(hrefKey, href);
24493
+ document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
24494
+ if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
24495
+ });
24496
+ nodes.set(hrefKey, href);
24497
+ }
24498
+ if (nodes.size === 0) return 0;
24499
+ deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
24500
+ deps.postToParent({
24501
+ type: "ow:change",
24502
+ nodes: [...nodes].map(([key, text]) => ({ key, text }))
24503
+ });
24504
+ return plan.remove.length + plan.relabel.length + plan.retarget.length;
24505
+ }
24506
+ function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
24507
+ (0, import_react23.useEffect)(() => {
24508
+ if (!isEditMode) return;
24509
+ const onMessage = (e) => {
24510
+ if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
24511
+ const changed = applyBuildPageSync(e.data, {
24512
+ getEditContent: () => editContentRef.current,
24513
+ setEditContent: (next) => {
24514
+ editContentRef.current = next;
24515
+ },
24516
+ postToParent: postToParent2
24517
+ });
24518
+ postToParent2({ type: "ow:pages-synced", changed });
24519
+ };
24520
+ window.addEventListener("message", onMessage);
24521
+ return () => window.removeEventListener("message", onMessage);
24522
+ }, [isEditMode, editContentRef, postToParent2]);
24523
+ }
24524
+
24525
+ // src/lib/nav-page-sync.ts
24526
+ function labelKeyFor(hrefKey) {
24527
+ return hrefKey.replace(/-href$/, "-label");
24528
+ }
24529
+ function isPageLinkKey(key) {
24530
+ return isNavbarHrefKey(key) || isFooterHrefKey(key);
24531
+ }
24532
+ function currentHref(key, anchor, content) {
24533
+ const stored = content[key];
24534
+ if (typeof stored === "string" && stored.length > 0) return stored;
24535
+ return anchor.getAttribute("href") ?? "";
24536
+ }
24537
+ function normalizePath2(value) {
24538
+ if (value.length > 1 && value.endsWith("/")) return value.slice(0, -1);
24539
+ return value;
24540
+ }
24541
+ function pointsAt(href, path) {
24542
+ const normalized = normalizePath2(href);
24543
+ const target = normalizePath2(path);
24544
+ if (normalized === target) return true;
24545
+ return (normalized.startsWith(`${target}#`) || normalized.startsWith(`${target}?`)) && target !== "/";
24546
+ }
24547
+ function retargetHref(href, oldPath, newPath) {
24548
+ const normalized = normalizePath2(href);
24549
+ const target = normalizePath2(oldPath);
24550
+ if (normalized === target) return newPath;
24551
+ return `${newPath}${normalized.slice(target.length)}`;
24552
+ }
24553
+ function setLabelText(key, text) {
24554
+ document.querySelectorAll(`[data-ohw-key="${CSS.escape(key)}"]`).forEach((el) => {
24555
+ el.textContent = text;
24556
+ });
24557
+ }
24558
+ function commit(delta, deps) {
24559
+ if (Object.keys(delta).length === 0) return;
24560
+ deps.setEditContent({ ...deps.getEditContent(), ...delta });
24561
+ deps.postToParent({
24562
+ type: "ow:change",
24563
+ nodes: Object.entries(delta).map(([key, text]) => ({ key, text }))
24564
+ });
24565
+ }
24566
+ function navLinksTo(path, content) {
24567
+ return Array.from(document.querySelectorAll("[data-ohw-href-key]")).filter((anchor) => {
24568
+ const key = anchor.getAttribute("data-ohw-href-key");
24569
+ return isNavbarHrefKey(key) && pointsAt(currentHref(key, anchor, content), path);
24570
+ }).map((anchor) => anchor.getAttribute("data-ohw-href-key"));
24571
+ }
24572
+ function addNavLinkForPage(page, deps) {
24573
+ const content = deps.getEditContent();
24574
+ if (navLinksTo(page.path, content).length > 0) return false;
24575
+ const roots = listNavbarRootItems();
24576
+ const afterAnchor = roots[roots.length - 1] ?? null;
24577
+ let inserted;
24578
+ try {
24579
+ inserted = insertNavbarItem(page.path, page.title, afterAnchor);
24580
+ } catch {
24581
+ return false;
24582
+ }
24583
+ const { hrefKey, labelKey, index } = inserted;
24584
+ deps.applyLinkByKey(hrefKey, page.path);
24585
+ setLabelText(labelKey, page.title);
24586
+ commit(
24587
+ {
24588
+ [hrefKey]: page.path,
24589
+ [labelKey]: page.title,
24590
+ [NAV_COUNT_KEY]: String(index + 1),
24591
+ [NAV_ORDER_KEY]: getNavbarOrderJson()
24592
+ },
24593
+ deps
24594
+ );
24595
+ return true;
24596
+ }
24597
+ function retargetPageLinks(change, deps) {
24598
+ const { oldPath, newPath, oldTitle, newTitle } = change;
24599
+ if (!oldPath || !newPath || normalizePath2(oldPath) === normalizePath2(newPath)) return 0;
24600
+ const content = deps.getEditContent();
24601
+ const delta = {};
24602
+ for (const anchor of Array.from(document.querySelectorAll("[data-ohw-href-key]"))) {
24603
+ const hrefKey = anchor.getAttribute("data-ohw-href-key");
24604
+ if (!isPageLinkKey(hrefKey)) continue;
24605
+ const href = currentHref(hrefKey, anchor, content);
24606
+ if (!pointsAt(href, oldPath)) continue;
24607
+ const nextHref = retargetHref(href, oldPath, newPath);
24608
+ deps.applyLinkByKey(hrefKey, nextHref);
24609
+ delta[hrefKey] = nextHref;
24610
+ if (!oldTitle || !newTitle) continue;
24611
+ const labelKey = labelKeyFor(hrefKey);
24612
+ const label = content[labelKey] ?? anchor.querySelector('[data-ohw-editable="text"]')?.textContent ?? "";
24613
+ if (label.trim() !== oldTitle) continue;
24614
+ setLabelText(labelKey, newTitle);
24615
+ delta[labelKey] = newTitle;
24616
+ }
24617
+ commit(delta, deps);
24618
+ return Object.keys(delta).filter((key) => key.endsWith("-href")).length;
24619
+ }
24620
+
24204
24621
  // src/ui/navbar-container-chrome.tsx
24205
24622
  var import_lucide_react21 = require("lucide-react");
24206
24623
  var import_jsx_runtime37 = require("react/jsx-runtime");
@@ -25088,7 +25505,7 @@ function getNavigationSelectionParent(el) {
25088
25505
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25089
25506
  return resolveFooterLinksContainerFrom(el);
25090
25507
  }
25091
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25508
+ 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)) {
25092
25509
  return getNavigationRoot(el);
25093
25510
  }
25094
25511
  return null;
@@ -25310,7 +25727,6 @@ var ICONS = {
25310
25727
  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"/>',
25311
25728
  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"/>'
25312
25729
  };
25313
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25314
25730
  var SELECTION_CHROME_GAP2 = 4;
25315
25731
  var TOOLBAR_STROKE_GAP2 = 4;
25316
25732
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25408,7 +25824,7 @@ function applyVisibleViewport(el, parentScroll) {
25408
25824
  el.style.top = `${top}px`;
25409
25825
  el.style.height = `${height}px`;
25410
25826
  }
25411
- var TOOLBAR_EDGE_MARGIN3 = 4;
25827
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25412
25828
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25413
25829
  const isAbove = transform.includes("translateY(-100%)");
25414
25830
  let visualTop = isAbove ? top - approxH : top;
@@ -25435,8 +25851,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25435
25851
  function clampToolbarLeft(centerX, toolbarWidth) {
25436
25852
  const half = toolbarWidth / 2;
25437
25853
  return Math.max(
25438
- TOOLBAR_EDGE_MARGIN3 + half,
25439
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
25854
+ TOOLBAR_EDGE_MARGIN4 + half,
25855
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25440
25856
  );
25441
25857
  }
25442
25858
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -25560,9 +25976,9 @@ function FloatingToolbar({
25560
25976
  showEditLink,
25561
25977
  onEditLink
25562
25978
  }) {
25563
- const localRef = import_react23.default.useRef(null);
25564
- const [measuredW, setMeasuredW] = import_react23.default.useState(330);
25565
- const setRefs = import_react23.default.useCallback(
25979
+ const localRef = import_react24.default.useRef(null);
25980
+ const [measuredW, setMeasuredW] = import_react24.default.useState(330);
25981
+ const setRefs = import_react24.default.useCallback(
25566
25982
  (node) => {
25567
25983
  localRef.current = node;
25568
25984
  if (typeof elRef === "function") elRef(node);
@@ -25574,7 +25990,7 @@ function FloatingToolbar({
25574
25990
  },
25575
25991
  [elRef]
25576
25992
  );
25577
- import_react23.default.useLayoutEffect(() => {
25993
+ import_react24.default.useLayoutEffect(() => {
25578
25994
  const node = localRef.current;
25579
25995
  if (!node) return;
25580
25996
  const update = () => {
@@ -25600,7 +26016,7 @@ function FloatingToolbar({
25600
26016
  pointerEvents: "auto"
25601
26017
  },
25602
26018
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
25603
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react23.default.Fragment, { children: [
26019
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react24.default.Fragment, { children: [
25604
26020
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
25605
26021
  btns.map((btn) => {
25606
26022
  const isActive = activeCommands.has(btn.cmd);
@@ -25809,8 +26225,8 @@ function OhhwellsBridge() {
25809
26225
  const router = (0, import_navigation4.useRouter)();
25810
26226
  const searchParams = (0, import_navigation4.useSearchParams)();
25811
26227
  const isEditMode = isEditSessionActive();
25812
- const [bridgeRoot, setBridgeRoot] = (0, import_react23.useState)(null);
25813
- (0, import_react23.useEffect)(() => {
26228
+ const [bridgeRoot, setBridgeRoot] = (0, import_react24.useState)(null);
26229
+ (0, import_react24.useEffect)(() => {
25814
26230
  const figtreeFontId = "ohw-figtree-font";
25815
26231
  if (!document.getElementById(figtreeFontId)) {
25816
26232
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -25836,8 +26252,8 @@ function OhhwellsBridge() {
25836
26252
  };
25837
26253
  }, []);
25838
26254
  const subdomainFromQuery = searchParams.get("subdomain");
25839
- const [subdomain, setSubdomain] = (0, import_react23.useState)(() => resolveSubdomain(subdomainFromQuery));
25840
- (0, import_react23.useLayoutEffect)(() => {
26255
+ const [subdomain, setSubdomain] = (0, import_react24.useState)(() => resolveSubdomain(subdomainFromQuery));
26256
+ (0, import_react24.useLayoutEffect)(() => {
25841
26257
  const next = resolveSubdomain(subdomainFromQuery);
25842
26258
  if (next !== subdomain) setSubdomain(next);
25843
26259
  if (next) return;
@@ -25849,7 +26265,7 @@ function OhhwellsBridge() {
25849
26265
  }, 0);
25850
26266
  return () => window.clearTimeout(t);
25851
26267
  }, [subdomainFromQuery, subdomain]);
25852
- (0, import_react23.useEffect)(() => {
26268
+ (0, import_react24.useEffect)(() => {
25853
26269
  if (!subdomainFromQuery || typeof window === "undefined") return;
25854
26270
  const url = new URL(window.location.href);
25855
26271
  if (!url.searchParams.has("subdomain")) return;
@@ -25861,22 +26277,22 @@ function OhhwellsBridge() {
25861
26277
  useSavedLinkNavigation(isEditMode);
25862
26278
  useNavDropdownToggle(isEditMode);
25863
26279
  useHashLinkScroll(isEditMode);
25864
- const postToParent2 = (0, import_react23.useCallback)((data) => {
26280
+ const postToParent2 = (0, import_react24.useCallback)((data) => {
25865
26281
  if (typeof window !== "undefined" && window.parent !== window) {
25866
26282
  window.parent.postMessage(data, "*");
25867
26283
  }
25868
26284
  }, []);
25869
- const [fetchState, setFetchState] = (0, import_react23.useState)("idle");
25870
- const [showBranding, setShowBranding] = (0, import_react23.useState)(false);
25871
- const autoSaveTimers = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
25872
- (0, import_react23.useEffect)(() => {
26285
+ const [fetchState, setFetchState] = (0, import_react24.useState)("idle");
26286
+ const [showBranding, setShowBranding] = (0, import_react24.useState)(false);
26287
+ const autoSaveTimers = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26288
+ (0, import_react24.useEffect)(() => {
25873
26289
  stampBridgeVersionOnDocument();
25874
26290
  }, []);
25875
- (0, import_react23.useEffect)(() => {
26291
+ (0, import_react24.useEffect)(() => {
25876
26292
  if (isEditMode) return;
25877
26293
  return armLoaderHangBeacon(subdomain, fetchState);
25878
26294
  }, [isEditMode, subdomain, fetchState]);
25879
- (0, import_react23.useEffect)(() => {
26295
+ (0, import_react24.useEffect)(() => {
25880
26296
  if (isEditMode || !subdomain) return;
25881
26297
  const onError = (event) => {
25882
26298
  reportOutageBeacon({
@@ -25897,40 +26313,40 @@ function OhhwellsBridge() {
25897
26313
  window.removeEventListener("unhandledrejection", onRejection);
25898
26314
  };
25899
26315
  }, [isEditMode, subdomain]);
25900
- const activeElRef = (0, import_react23.useRef)(null);
25901
- const pointerHeldRef = (0, import_react23.useRef)(false);
25902
- const selectedElRef = (0, import_react23.useRef)(null);
25903
- const selectedHrefKeyRef = (0, import_react23.useRef)(null);
25904
- const selectedFooterColAttrRef = (0, import_react23.useRef)(null);
25905
- const footerHeadingTitleCacheRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
25906
- const originalContentRef = (0, import_react23.useRef)(null);
25907
- const activeStateElRef = (0, import_react23.useRef)(null);
25908
- const parentScrollRef = (0, import_react23.useRef)(null);
25909
- const visibleViewportRef = (0, import_react23.useRef)(null);
25910
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react23.useState)(null);
25911
- const attachVisibleViewport = (0, import_react23.useCallback)((node) => {
26316
+ const activeElRef = (0, import_react24.useRef)(null);
26317
+ const pointerHeldRef = (0, import_react24.useRef)(false);
26318
+ const selectedElRef = (0, import_react24.useRef)(null);
26319
+ const selectedHrefKeyRef = (0, import_react24.useRef)(null);
26320
+ const selectedFooterColAttrRef = (0, import_react24.useRef)(null);
26321
+ const footerHeadingTitleCacheRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26322
+ const originalContentRef = (0, import_react24.useRef)(null);
26323
+ const activeStateElRef = (0, import_react24.useRef)(null);
26324
+ const parentScrollRef = (0, import_react24.useRef)(null);
26325
+ const visibleViewportRef = (0, import_react24.useRef)(null);
26326
+ const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react24.useState)(null);
26327
+ const attachVisibleViewport = (0, import_react24.useCallback)((node) => {
25912
26328
  visibleViewportRef.current = node;
25913
26329
  setDialogPortalContainer(node);
25914
26330
  if (node) applyVisibleViewport(node, parentScrollRef.current);
25915
26331
  }, []);
25916
- const toolbarElRef = (0, import_react23.useRef)(null);
25917
- const glowElRef = (0, import_react23.useRef)(null);
25918
- const hoveredImageRef = (0, import_react23.useRef)(null);
25919
- const hoveredImageHasTextOverlapRef = (0, import_react23.useRef)(false);
25920
- const dragOverElRef = (0, import_react23.useRef)(null);
25921
- const [mediaHover, setMediaHover] = (0, import_react23.useState)(null);
25922
- const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react23.useState)(null);
25923
- const selectedAiSectionIdRef = (0, import_react23.useRef)(null);
25924
- const handleAiSectionSelectionChange = (0, import_react23.useCallback)((id) => {
26332
+ const toolbarElRef = (0, import_react24.useRef)(null);
26333
+ const glowElRef = (0, import_react24.useRef)(null);
26334
+ const hoveredImageRef = (0, import_react24.useRef)(null);
26335
+ const hoveredImageHasTextOverlapRef = (0, import_react24.useRef)(false);
26336
+ const dragOverElRef = (0, import_react24.useRef)(null);
26337
+ const [mediaHover, setMediaHover] = (0, import_react24.useState)(null);
26338
+ const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react24.useState)(null);
26339
+ const selectedAiSectionIdRef = (0, import_react24.useRef)(null);
26340
+ const handleAiSectionSelectionChange = (0, import_react24.useCallback)((id) => {
25925
26341
  selectedAiSectionIdRef.current = id;
25926
26342
  setSelectedAiSectionId(id);
25927
26343
  }, []);
25928
- const [selectedMedia, setSelectedMedia] = (0, import_react23.useState)(null);
25929
- const selectedMediaElRef = (0, import_react23.useRef)(null);
25930
- const mediaKeyDropTokenRef = (0, import_react23.useRef)(0);
25931
- const selectedIconElRef = (0, import_react23.useRef)(null);
25932
- const selectedSocialElRef = (0, import_react23.useRef)(null);
25933
- const queueSectionKeyDrop = (0, import_react23.useCallback)((prev) => {
26344
+ const [selectedMedia, setSelectedMedia] = (0, import_react24.useState)(null);
26345
+ const selectedMediaElRef = (0, import_react24.useRef)(null);
26346
+ const mediaKeyDropTokenRef = (0, import_react24.useRef)(0);
26347
+ const selectedIconElRef = (0, import_react24.useRef)(null);
26348
+ const selectedSocialElRef = (0, import_react24.useRef)(null);
26349
+ const queueSectionKeyDrop = (0, import_react24.useCallback)((prev) => {
25934
26350
  const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
25935
26351
  if (!sectionEl) return;
25936
26352
  const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
@@ -25951,31 +26367,31 @@ function OhhwellsBridge() {
25951
26367
  window.addEventListener("message", onQueueDrained);
25952
26368
  window.postMessage({ type: "ow:media-key-drop", token }, "*");
25953
26369
  }, []);
25954
- const clearMediaSelection = (0, import_react23.useCallback)(() => {
26370
+ const clearMediaSelection = (0, import_react24.useCallback)(() => {
25955
26371
  const prev = selectedMediaElRef.current;
25956
26372
  selectedMediaElRef.current = null;
25957
26373
  setSelectedMedia(null);
25958
26374
  queueSectionKeyDrop(prev);
25959
26375
  }, [queueSectionKeyDrop]);
25960
- const clearMediaSelectionRef = (0, import_react23.useRef)(clearMediaSelection);
26376
+ const clearMediaSelectionRef = (0, import_react24.useRef)(clearMediaSelection);
25961
26377
  clearMediaSelectionRef.current = clearMediaSelection;
25962
- const clearIconSelection = (0, import_react23.useCallback)(() => {
26378
+ const clearIconSelection = (0, import_react24.useCallback)(() => {
25963
26379
  const prev = selectedIconElRef.current;
25964
26380
  if (!prev) return;
25965
26381
  selectedIconElRef.current = null;
25966
26382
  queueSectionKeyDrop(prev);
25967
26383
  }, [queueSectionKeyDrop]);
25968
- const clearIconSelectionRef = (0, import_react23.useRef)(clearIconSelection);
26384
+ const clearIconSelectionRef = (0, import_react24.useRef)(clearIconSelection);
25969
26385
  clearIconSelectionRef.current = clearIconSelection;
25970
- const clearSocialSelection = (0, import_react23.useCallback)(() => {
26386
+ const clearSocialSelection = (0, import_react24.useCallback)(() => {
25971
26387
  const prev = selectedSocialElRef.current;
25972
26388
  if (!prev) return;
25973
26389
  selectedSocialElRef.current = null;
25974
26390
  queueSectionKeyDrop(prev);
25975
26391
  }, [queueSectionKeyDrop]);
25976
- const clearSocialSelectionRef = (0, import_react23.useRef)(clearSocialSelection);
26392
+ const clearSocialSelectionRef = (0, import_react24.useRef)(clearSocialSelection);
25977
26393
  clearSocialSelectionRef.current = clearSocialSelection;
25978
- const selectIconElement = (0, import_react23.useCallback)((el) => {
26394
+ const selectIconElement = (0, import_react24.useCallback)((el) => {
25979
26395
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
25980
26396
  selectedIconElRef.current = el;
25981
26397
  const sectionEl = el.closest("[data-ohw-section]");
@@ -25988,9 +26404,9 @@ function OhhwellsBridge() {
25988
26404
  keyLabel: "Icon"
25989
26405
  });
25990
26406
  }, []);
25991
- const selectIconElementRef = (0, import_react23.useRef)(selectIconElement);
26407
+ const selectIconElementRef = (0, import_react24.useRef)(selectIconElement);
25992
26408
  selectIconElementRef.current = selectIconElement;
25993
- const selectMediaElement = (0, import_react23.useCallback)((el) => {
26409
+ const selectMediaElement = (0, import_react24.useCallback)((el) => {
25994
26410
  const r2 = el.getBoundingClientRect();
25995
26411
  const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
25996
26412
  selectedIconElRef.current = null;
@@ -26015,9 +26431,9 @@ function OhhwellsBridge() {
26015
26431
  keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
26016
26432
  });
26017
26433
  }, []);
26018
- const selectMediaElementRef = (0, import_react23.useRef)(selectMediaElement);
26434
+ const selectMediaElementRef = (0, import_react24.useRef)(selectMediaElement);
26019
26435
  selectMediaElementRef.current = selectMediaElement;
26020
- (0, import_react23.useEffect)(() => {
26436
+ (0, import_react24.useEffect)(() => {
26021
26437
  if (!selectedMedia) return;
26022
26438
  const update = () => {
26023
26439
  const el = selectedMediaElRef.current;
@@ -26037,54 +26453,54 @@ function OhhwellsBridge() {
26037
26453
  window.removeEventListener("resize", update);
26038
26454
  };
26039
26455
  }, [selectedMedia !== null]);
26040
- const [carouselHover, setCarouselHover] = (0, import_react23.useState)(null);
26041
- const [uploadingRects, setUploadingRects] = (0, import_react23.useState)({});
26042
- const hoveredGapRef = (0, import_react23.useRef)(null);
26043
- const imageUnhoverTimerRef = (0, import_react23.useRef)(null);
26044
- const imageShowTimerRef = (0, import_react23.useRef)(null);
26045
- const editStylesRef = (0, import_react23.useRef)(null);
26046
- const activateRef = (0, import_react23.useRef)(() => {
26456
+ const [carouselHover, setCarouselHover] = (0, import_react24.useState)(null);
26457
+ const [uploadingRects, setUploadingRects] = (0, import_react24.useState)({});
26458
+ const hoveredGapRef = (0, import_react24.useRef)(null);
26459
+ const imageUnhoverTimerRef = (0, import_react24.useRef)(null);
26460
+ const imageShowTimerRef = (0, import_react24.useRef)(null);
26461
+ const editStylesRef = (0, import_react24.useRef)(null);
26462
+ const activateRef = (0, import_react24.useRef)(() => {
26047
26463
  });
26048
- const deactivateRef = (0, import_react23.useRef)(() => {
26464
+ const deactivateRef = (0, import_react24.useRef)(() => {
26049
26465
  });
26050
- const selectRef = (0, import_react23.useRef)(() => {
26466
+ const selectRef = (0, import_react24.useRef)(() => {
26051
26467
  });
26052
- const selectFrameRef = (0, import_react23.useRef)(() => {
26468
+ const selectFrameRef = (0, import_react24.useRef)(() => {
26053
26469
  });
26054
- const selectLogoRef = (0, import_react23.useRef)(() => {
26470
+ const selectLogoRef = (0, import_react24.useRef)(() => {
26055
26471
  });
26056
- const openLogoSizePanelRef = (0, import_react23.useRef)(() => {
26472
+ const openLogoSizePanelRef = (0, import_react24.useRef)(() => {
26057
26473
  });
26058
- const deselectRef = (0, import_react23.useRef)(() => {
26474
+ const deselectRef = (0, import_react24.useRef)(() => {
26059
26475
  });
26060
- const closeFloatingPanelOnlyRef = (0, import_react23.useRef)(() => {
26476
+ const closeFloatingPanelOnlyRef = (0, import_react24.useRef)(() => {
26061
26477
  });
26062
- const reselectNavigationItemRef = (0, import_react23.useRef)(() => {
26478
+ const reselectNavigationItemRef = (0, import_react24.useRef)(() => {
26063
26479
  });
26064
- const commitNavigationTextEditRef = (0, import_react23.useRef)(() => {
26480
+ const commitNavigationTextEditRef = (0, import_react24.useRef)(() => {
26065
26481
  });
26066
- const handleDeleteSelectedRef = (0, import_react23.useRef)(() => false);
26067
- const runPendingDeleteUndoRef = (0, import_react23.useRef)(() => false);
26068
- const isFooterFrameSelectionRef = (0, import_react23.useRef)(false);
26069
- const refreshActiveCommandsRef = (0, import_react23.useRef)(() => {
26482
+ const handleDeleteSelectedRef = (0, import_react24.useRef)(() => false);
26483
+ const runPendingDeleteUndoRef = (0, import_react24.useRef)(() => false);
26484
+ const isFooterFrameSelectionRef = (0, import_react24.useRef)(false);
26485
+ const refreshActiveCommandsRef = (0, import_react24.useRef)(() => {
26070
26486
  });
26071
- const postToParentRef = (0, import_react23.useRef)(postToParent2);
26487
+ const postToParentRef = (0, import_react24.useRef)(postToParent2);
26072
26488
  postToParentRef.current = postToParent2;
26073
- const aiSectionApiRef = (0, import_react23.useRef)(null);
26074
- const sectionsLoadedRef = (0, import_react23.useRef)(false);
26075
- const pendingScheduleConfigRequests = (0, import_react23.useRef)([]);
26076
- const [toolbarRect, setToolbarRect] = (0, import_react23.useState)(null);
26077
- const [formPickRect, setFormPickRect] = (0, import_react23.useState)(null);
26078
- const formPickElRef = (0, import_react23.useRef)(null);
26079
- const [formViewState, setFormViewStateUi] = (0, import_react23.useState)("default");
26080
- const [formPickCount, setFormPickCount] = (0, import_react23.useState)(null);
26081
- const [formHoverRect, setFormHoverRect] = (0, import_react23.useState)(null);
26082
- const formHoverElRef = (0, import_react23.useRef)(null);
26083
- const [fieldPickRect, setFieldPickRect] = (0, import_react23.useState)(null);
26084
- const fieldPickElRef = (0, import_react23.useRef)(null);
26085
- const [fieldPickState, setFieldPickState] = (0, import_react23.useState)(null);
26086
- const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react23.useState)(false);
26087
- const clearFormPick = (0, import_react23.useCallback)(() => {
26489
+ const aiSectionApiRef = (0, import_react24.useRef)(null);
26490
+ const sectionsLoadedRef = (0, import_react24.useRef)(false);
26491
+ const pendingScheduleConfigRequests = (0, import_react24.useRef)([]);
26492
+ const [toolbarRect, setToolbarRect] = (0, import_react24.useState)(null);
26493
+ const [formPickRect, setFormPickRect] = (0, import_react24.useState)(null);
26494
+ const formPickElRef = (0, import_react24.useRef)(null);
26495
+ const [formViewState, setFormViewStateUi] = (0, import_react24.useState)("default");
26496
+ const [formPickCount, setFormPickCount] = (0, import_react24.useState)(null);
26497
+ const [formHoverRect, setFormHoverRect] = (0, import_react24.useState)(null);
26498
+ const formHoverElRef = (0, import_react24.useRef)(null);
26499
+ const [fieldPickRect, setFieldPickRect] = (0, import_react24.useState)(null);
26500
+ const fieldPickElRef = (0, import_react24.useRef)(null);
26501
+ const [fieldPickState, setFieldPickState] = (0, import_react24.useState)(null);
26502
+ const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react24.useState)(false);
26503
+ const clearFormPick = (0, import_react24.useCallback)(() => {
26088
26504
  const form = formPickElRef.current;
26089
26505
  const editing = fieldPickElRef.current;
26090
26506
  if (commitPlaceholderEdit(editing) && editing) {
@@ -26104,7 +26520,7 @@ function OhhwellsBridge() {
26104
26520
  formPickElRef.current = null;
26105
26521
  setFormPickRect(null);
26106
26522
  }, []);
26107
- const clearFieldPick = (0, import_react23.useCallback)(() => {
26523
+ const clearFieldPick = (0, import_react24.useCallback)(() => {
26108
26524
  const wrapper = fieldPickElRef.current;
26109
26525
  if (commitPlaceholderEdit(wrapper) && wrapper) {
26110
26526
  const form = wrapper.closest('[data-ohw-editable="form"]');
@@ -26114,9 +26530,9 @@ function OhhwellsBridge() {
26114
26530
  setFieldPickRect(null);
26115
26531
  setFieldPickState(null);
26116
26532
  }, []);
26117
- const persistFieldsRef = (0, import_react23.useRef)(() => {
26533
+ const persistFieldsRef = (0, import_react24.useRef)(() => {
26118
26534
  });
26119
- const persistFields = (0, import_react23.useCallback)(
26535
+ const persistFields = (0, import_react24.useCallback)(
26120
26536
  (form) => {
26121
26537
  const key = formKeyOf(form);
26122
26538
  if (!key) return;
@@ -26127,7 +26543,7 @@ function OhhwellsBridge() {
26127
26543
  []
26128
26544
  );
26129
26545
  persistFieldsRef.current = persistFields;
26130
- const selectField = (0, import_react23.useCallback)((wrapper) => {
26546
+ const selectField = (0, import_react24.useCallback)((wrapper) => {
26131
26547
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
26132
26548
  commitPlaceholderEdit(fieldPickElRef.current);
26133
26549
  }
@@ -26140,7 +26556,7 @@ function OhhwellsBridge() {
26140
26556
  setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
26141
26557
  setFieldTypePickerOpen(false);
26142
26558
  }, []);
26143
- const withSelectedField = (0, import_react23.useCallback)(
26559
+ const withSelectedField = (0, import_react24.useCallback)(
26144
26560
  (run) => {
26145
26561
  const wrapper = fieldPickElRef.current;
26146
26562
  const form = formPickElRef.current;
@@ -26153,28 +26569,28 @@ function OhhwellsBridge() {
26153
26569
  },
26154
26570
  [persistFields]
26155
26571
  );
26156
- const handleFieldTypeChange = (0, import_react23.useCallback)(
26572
+ const handleFieldTypeChange = (0, import_react24.useCallback)(
26157
26573
  (type) => withSelectedField((_form, wrapper) => {
26158
26574
  applyFieldType(wrapper, type);
26159
26575
  selectField(wrapper);
26160
26576
  }),
26161
26577
  [selectField, withSelectedField]
26162
26578
  );
26163
- const handleFieldRequiredToggle = (0, import_react23.useCallback)(
26579
+ const handleFieldRequiredToggle = (0, import_react24.useCallback)(
26164
26580
  () => withSelectedField((_form, wrapper) => {
26165
26581
  setFieldRequired(wrapper, !isFieldRequired(wrapper));
26166
26582
  selectField(wrapper);
26167
26583
  }),
26168
26584
  [selectField, withSelectedField]
26169
26585
  );
26170
- const handleFieldDuplicate = (0, import_react23.useCallback)(
26586
+ const handleFieldDuplicate = (0, import_react24.useCallback)(
26171
26587
  () => withSelectedField((form, wrapper) => {
26172
26588
  const copy = duplicateField(form, wrapper);
26173
26589
  selectField(copy);
26174
26590
  }),
26175
26591
  [selectField, withSelectedField]
26176
26592
  );
26177
- const handleFieldDelete = (0, import_react23.useCallback)(
26593
+ const handleFieldDelete = (0, import_react24.useCallback)(
26178
26594
  () => withSelectedField((_form, wrapper) => {
26179
26595
  removeField(wrapper);
26180
26596
  clearFieldPick();
@@ -26182,7 +26598,7 @@ function OhhwellsBridge() {
26182
26598
  }),
26183
26599
  [clearFieldPick, withSelectedField]
26184
26600
  );
26185
- const handleAddField = (0, import_react23.useCallback)(
26601
+ const handleAddField = (0, import_react24.useCallback)(
26186
26602
  (type) => {
26187
26603
  const form = formPickElRef.current;
26188
26604
  if (!form) return;
@@ -26198,8 +26614,8 @@ function OhhwellsBridge() {
26198
26614
  },
26199
26615
  [persistFields, selectField]
26200
26616
  );
26201
- const fieldDragRef = (0, import_react23.useRef)(null);
26202
- const buildFieldDropSlots = (0, import_react23.useCallback)((form, draggedKey) => {
26617
+ const fieldDragRef = (0, import_react24.useRef)(null);
26618
+ const buildFieldDropSlots = (0, import_react24.useCallback)((form, draggedKey) => {
26203
26619
  const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
26204
26620
  const slots = others.map((el) => {
26205
26621
  const rect = el.getBoundingClientRect();
@@ -26212,7 +26628,7 @@ function OhhwellsBridge() {
26212
26628
  }
26213
26629
  return slots;
26214
26630
  }, []);
26215
- const handleFieldDragStart = (0, import_react23.useCallback)(() => {
26631
+ const handleFieldDragStart = (0, import_react24.useCallback)(() => {
26216
26632
  const wrapper = fieldPickElRef.current;
26217
26633
  const form = formPickElRef.current;
26218
26634
  if (!wrapper || !form) return;
@@ -26221,18 +26637,18 @@ function OhhwellsBridge() {
26221
26637
  setFieldDragging(true);
26222
26638
  setFieldDropSlots(buildFieldDropSlots(form, key));
26223
26639
  }, [buildFieldDropSlots]);
26224
- const handleFieldDragEnd = (0, import_react23.useCallback)(() => {
26640
+ const handleFieldDragEnd = (0, import_react24.useCallback)(() => {
26225
26641
  fieldDragRef.current = null;
26226
26642
  setFieldDropIndex(null);
26227
26643
  setFieldDropSlots([]);
26228
26644
  setFieldDragging(false);
26229
26645
  }, []);
26230
- const [fieldDropIndex, setFieldDropIndex] = (0, import_react23.useState)(null);
26231
- const [fieldDropSlots, setFieldDropSlots] = (0, import_react23.useState)([]);
26232
- const [fieldDragging, setFieldDragging] = (0, import_react23.useState)(false);
26233
- const clearFormPickRef = (0, import_react23.useRef)(clearFormPick);
26646
+ const [fieldDropIndex, setFieldDropIndex] = (0, import_react24.useState)(null);
26647
+ const [fieldDropSlots, setFieldDropSlots] = (0, import_react24.useState)([]);
26648
+ const [fieldDragging, setFieldDragging] = (0, import_react24.useState)(false);
26649
+ const clearFormPickRef = (0, import_react24.useRef)(clearFormPick);
26234
26650
  clearFormPickRef.current = clearFormPick;
26235
- (0, import_react23.useEffect)(() => {
26651
+ (0, import_react24.useEffect)(() => {
26236
26652
  const el = fieldPickElRef.current;
26237
26653
  if (!el || fieldPickRect === null) return;
26238
26654
  const observer = new ResizeObserver(() => {
@@ -26241,7 +26657,7 @@ function OhhwellsBridge() {
26241
26657
  observer.observe(el);
26242
26658
  return () => observer.disconnect();
26243
26659
  }, [fieldPickRect !== null, fieldPickState]);
26244
- (0, import_react23.useEffect)(() => {
26660
+ (0, import_react24.useEffect)(() => {
26245
26661
  const el = formPickElRef.current;
26246
26662
  if (!el || formPickRect === null) return;
26247
26663
  const observer = new ResizeObserver(() => {
@@ -26250,25 +26666,25 @@ function OhhwellsBridge() {
26250
26666
  observer.observe(el);
26251
26667
  return () => observer.disconnect();
26252
26668
  }, [formPickRect !== null, formViewState]);
26253
- const [toolbarVariant, setToolbarVariant] = (0, import_react23.useState)("none");
26254
- const toolbarVariantRef = (0, import_react23.useRef)("none");
26669
+ const [toolbarVariant, setToolbarVariant] = (0, import_react24.useState)("none");
26670
+ const toolbarVariantRef = (0, import_react24.useRef)("none");
26255
26671
  toolbarVariantRef.current = toolbarVariant;
26256
- const [selectedIsCta, setSelectedIsCta] = (0, import_react23.useState)(false);
26257
- const [selectedIsSocial, setSelectedIsSocial] = (0, import_react23.useState)(false);
26258
- const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react23.useState)(false);
26259
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react23.useState)(null);
26260
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react23.useState)(false);
26261
- const [toggleState, setToggleState] = (0, import_react23.useState)(null);
26262
- const [maxBadge, setMaxBadge] = (0, import_react23.useState)(null);
26263
- const [activeCommands, setActiveCommands] = (0, import_react23.useState)(/* @__PURE__ */ new Set());
26264
- const [sectionGap, setSectionGap] = (0, import_react23.useState)(null);
26265
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react23.useState)(false);
26266
- const hoveredNavContainerRef = (0, import_react23.useRef)(null);
26267
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react23.useState)(null);
26268
- const hoveredItemElRef = (0, import_react23.useRef)(null);
26269
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react23.useState)(null);
26270
- const [hoveredTextRect, setHoveredTextRect] = (0, import_react23.useState)(null);
26271
- (0, import_react23.useEffect)(() => {
26672
+ const [selectedIsCta, setSelectedIsCta] = (0, import_react24.useState)(false);
26673
+ const [selectedIsSocial, setSelectedIsSocial] = (0, import_react24.useState)(false);
26674
+ const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react24.useState)(false);
26675
+ const [reorderHrefKey, setReorderHrefKey] = (0, import_react24.useState)(null);
26676
+ const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react24.useState)(false);
26677
+ const [toggleState, setToggleState] = (0, import_react24.useState)(null);
26678
+ const [maxBadge, setMaxBadge] = (0, import_react24.useState)(null);
26679
+ const [activeCommands, setActiveCommands] = (0, import_react24.useState)(/* @__PURE__ */ new Set());
26680
+ const [sectionGap, setSectionGap] = (0, import_react24.useState)(null);
26681
+ const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react24.useState)(false);
26682
+ const hoveredNavContainerRef = (0, import_react24.useRef)(null);
26683
+ const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react24.useState)(null);
26684
+ const hoveredItemElRef = (0, import_react24.useRef)(null);
26685
+ const [hoveredItemRect, setHoveredItemRect] = (0, import_react24.useState)(null);
26686
+ const [hoveredTextRect, setHoveredTextRect] = (0, import_react24.useState)(null);
26687
+ (0, import_react24.useEffect)(() => {
26272
26688
  const sync = () => {
26273
26689
  const el = document.querySelector(
26274
26690
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -26312,63 +26728,75 @@ function OhhwellsBridge() {
26312
26728
  });
26313
26729
  return () => observer.disconnect();
26314
26730
  }, []);
26315
- const siblingHintElRef = (0, import_react23.useRef)(null);
26316
- const [siblingHintRect, setSiblingHintRect] = (0, import_react23.useState)(null);
26317
- const [siblingHintRects, setSiblingHintRects] = (0, import_react23.useState)([]);
26318
- const [isItemDragging, setIsItemDragging] = (0, import_react23.useState)(false);
26319
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react23.useState)(false);
26731
+ const siblingHintElRef = (0, import_react24.useRef)(null);
26732
+ const [siblingHintRect, setSiblingHintRect] = (0, import_react24.useState)(null);
26733
+ const [siblingHintRects, setSiblingHintRects] = (0, import_react24.useState)([]);
26734
+ const [isItemDragging, setIsItemDragging] = (0, import_react24.useState)(false);
26735
+ const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react24.useState)(false);
26320
26736
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26321
- const [floatingPanel, setFloatingPanel] = (0, import_react23.useState)(null);
26322
- const floatingPanelOpenRef = (0, import_react23.useRef)(false);
26323
- floatingPanelOpenRef.current = floatingPanel !== null;
26324
- const floatingPanelRef = (0, import_react23.useRef)(null);
26325
- floatingPanelRef.current = floatingPanel;
26326
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react23.useState)(null);
26327
- const buttonCollectionDragRef = (0, import_react23.useRef)(null);
26328
- const buttonDropInsertIndexRef = (0, import_react23.useRef)(null);
26329
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react23.useState)([]);
26330
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react23.useState)(null);
26331
- const buttonPointerDragRef = (0, import_react23.useRef)(null);
26332
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react23.useState)(0);
26333
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react23.useState)(null);
26334
- const [editorViewport, setEditorViewport] = (0, import_react23.useState)("desktop");
26335
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react23.useState)(null);
26336
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react23.useState)(null);
26337
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react23.useState)(null);
26338
- const footerDragRef = (0, import_react23.useRef)(null);
26339
- const [footerDropSlots, setFooterDropSlots] = (0, import_react23.useState)([]);
26340
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react23.useState)(null);
26341
- const [draggedItemRect, setDraggedItemRect] = (0, import_react23.useState)(null);
26342
- const footerPointerDragRef = (0, import_react23.useRef)(null);
26343
- const suppressNextClickRef = (0, import_react23.useRef)(false);
26344
- const suppressClickUntilRef = (0, import_react23.useRef)(0);
26345
- const [linkPopover, setLinkPopover] = (0, import_react23.useState)(null);
26346
- const linkPopoverSessionRef = (0, import_react23.useRef)(null);
26347
- const addNavAfterAnchorRef = (0, import_react23.useRef)(null);
26348
- const editContentRef = (0, import_react23.useRef)({});
26349
- const aiSectionsRef = (0, import_react23.useRef)("");
26350
- const aiFooterRef = (0, import_react23.useRef)("");
26351
- const applyTreeLocalRef = (0, import_react23.useRef)(
26737
+ const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react24.useState)(null);
26738
+ const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react24.useState)(null);
26739
+ const footerDragRef = (0, import_react24.useRef)(null);
26740
+ const [footerDropSlots, setFooterDropSlots] = (0, import_react24.useState)([]);
26741
+ const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react24.useState)(null);
26742
+ const [draggedItemRect, setDraggedItemRect] = (0, import_react24.useState)(null);
26743
+ const footerPointerDragRef = (0, import_react24.useRef)(null);
26744
+ const suppressNextClickRef = (0, import_react24.useRef)(false);
26745
+ const suppressClickUntilRef = (0, import_react24.useRef)(0);
26746
+ const [linkPopover, setLinkPopover] = (0, import_react24.useState)(null);
26747
+ const linkPopoverSessionRef = (0, import_react24.useRef)(null);
26748
+ const addNavAfterAnchorRef = (0, import_react24.useRef)(null);
26749
+ const editContentRef = (0, import_react24.useRef)({});
26750
+ useBuildPageSync(isEditMode, editContentRef, postToParent2);
26751
+ const aiSectionsRef = (0, import_react24.useRef)("");
26752
+ const aiFooterRef = (0, import_react24.useRef)("");
26753
+ const applyTreeLocalRef = (0, import_react24.useRef)(
26352
26754
  null
26353
26755
  );
26354
- const applyFooterTreeLocalRef = (0, import_react23.useRef)(null);
26355
- const clearInteractionChromeRef = (0, import_react23.useRef)(() => {
26756
+ const applyFooterTreeLocalRef = (0, import_react24.useRef)(null);
26757
+ const clearInteractionChromeRef = (0, import_react24.useRef)(() => {
26356
26758
  });
26357
- const brandKitRef = (0, import_react23.useRef)("");
26358
- const stylesRef = (0, import_react23.useRef)("");
26359
- const appliedDrawerRef = (0, import_react23.useRef)(null);
26360
- const pendingDeleteUndoRef = (0, import_react23.useRef)(null);
26361
- const [sitePages, setSitePages] = (0, import_react23.useState)([]);
26362
- const collectionItemsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26363
- const [sectionsByPath, setSectionsByPath] = (0, import_react23.useState)({});
26364
- const sectionsPrefetchGenRef = (0, import_react23.useRef)(0);
26365
- const setLinkPopoverRef = (0, import_react23.useRef)(setLinkPopover);
26366
- const linkPopoverPanelRef = (0, import_react23.useRef)(null);
26367
- const linkPopoverOpenRef = (0, import_react23.useRef)(false);
26368
- const linkPopoverGraceUntilRef = (0, import_react23.useRef)(0);
26759
+ const brandKitRef = (0, import_react24.useRef)("");
26760
+ const stylesRef = (0, import_react24.useRef)("");
26761
+ const appliedDrawerRef = (0, import_react24.useRef)(null);
26762
+ const pendingDeleteUndoRef = (0, import_react24.useRef)(null);
26763
+ const [floatingPanel, setFloatingPanel] = (0, import_react24.useState)(null);
26764
+ const floatingPanelOpenRef = (0, import_react24.useRef)(false);
26765
+ const floatingPanelRef = (0, import_react24.useRef)(null);
26766
+ floatingPanelRef.current = floatingPanel;
26767
+ const setFloatingPanelRef = (0, import_react24.useRef)(setFloatingPanel);
26768
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react24.useState)(null);
26769
+ const buttonCollectionDragRef = (0, import_react24.useRef)(null);
26770
+ const buttonDropInsertIndexRef = (0, import_react24.useRef)(null);
26771
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
26772
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
26773
+ const buttonPointerDragRef = (0, import_react24.useRef)(null);
26774
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
26775
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
26776
+ const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
26777
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
26778
+ const [sitePages, setSitePages] = (0, import_react24.useState)([]);
26779
+ const collectionItemsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26780
+ const [sectionsByPath, setSectionsByPath] = (0, import_react24.useState)({});
26781
+ const sectionsPrefetchGenRef = (0, import_react24.useRef)(0);
26782
+ const setLinkPopoverRef = (0, import_react24.useRef)(setLinkPopover);
26783
+ const linkPopoverPanelRef = (0, import_react24.useRef)(null);
26784
+ const linkPopoverOpenRef = (0, import_react24.useRef)(false);
26785
+ const linkPopoverGraceUntilRef = (0, import_react24.useRef)(0);
26369
26786
  setLinkPopoverRef.current = setLinkPopover;
26787
+ setFloatingPanelRef.current = setFloatingPanel;
26370
26788
  linkPopoverSessionRef.current = linkPopover;
26371
- (0, import_react23.useEffect)(() => {
26789
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
26790
+ (0, import_react24.useEffect)(() => {
26791
+ const syncViewport = () => {
26792
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26793
+ setEditorViewport((prev) => prev === next ? prev : next);
26794
+ };
26795
+ syncViewport();
26796
+ window.addEventListener("resize", syncViewport);
26797
+ return () => window.removeEventListener("resize", syncViewport);
26798
+ }, []);
26799
+ (0, import_react24.useEffect)(() => {
26372
26800
  setSectionOrderPersistHandler((entries) => {
26373
26801
  const currentPath = window.location.pathname;
26374
26802
  const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
@@ -26378,7 +26806,7 @@ function OhhwellsBridge() {
26378
26806
  });
26379
26807
  return () => setSectionOrderPersistHandler(null);
26380
26808
  }, []);
26381
- (0, import_react23.useEffect)(() => {
26809
+ (0, import_react24.useEffect)(() => {
26382
26810
  setAiFooterMountOptions({
26383
26811
  resolvePageHref: (pageOrAnchorId) => {
26384
26812
  const [pageId, anchor] = pageOrAnchorId.split("#");
@@ -26441,7 +26869,7 @@ function OhhwellsBridge() {
26441
26869
  const bumpLinkPopoverGrace = () => {
26442
26870
  linkPopoverGraceUntilRef.current = Date.now() + 350;
26443
26871
  };
26444
- const runSectionsPrefetch = (0, import_react23.useCallback)((pages) => {
26872
+ const runSectionsPrefetch = (0, import_react24.useCallback)((pages) => {
26445
26873
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
26446
26874
  const gen = ++sectionsPrefetchGenRef.current;
26447
26875
  const paths = pages.map((p) => p.path);
@@ -26460,9 +26888,9 @@ function OhhwellsBridge() {
26460
26888
  );
26461
26889
  });
26462
26890
  }, [isEditMode, pathname]);
26463
- const runSectionsPrefetchRef = (0, import_react23.useRef)(runSectionsPrefetch);
26891
+ const runSectionsPrefetchRef = (0, import_react24.useRef)(runSectionsPrefetch);
26464
26892
  runSectionsPrefetchRef.current = runSectionsPrefetch;
26465
- (0, import_react23.useEffect)(() => {
26893
+ (0, import_react24.useEffect)(() => {
26466
26894
  if (!linkPopover) {
26467
26895
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26468
26896
  return;
@@ -26490,7 +26918,7 @@ function OhhwellsBridge() {
26490
26918
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26491
26919
  };
26492
26920
  }, [linkPopover, postToParent2]);
26493
- (0, import_react23.useEffect)(() => {
26921
+ (0, import_react24.useEffect)(() => {
26494
26922
  if (!isEditMode) return;
26495
26923
  const useFixtures = shouldUseDevFixtures();
26496
26924
  if (useFixtures) {
@@ -26516,14 +26944,51 @@ function OhhwellsBridge() {
26516
26944
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
26517
26945
  return () => window.removeEventListener("message", onSitePages);
26518
26946
  }, [isEditMode, postToParent2]);
26519
- (0, import_react23.useEffect)(() => {
26947
+ (0, import_react24.useEffect)(() => {
26948
+ if (!isEditMode) return;
26949
+ const deps = {
26950
+ getEditContent: () => editContentRef.current,
26951
+ setEditContent: (next) => {
26952
+ editContentRef.current = next;
26953
+ },
26954
+ applyLinkByKey,
26955
+ postToParent: postToParent2
26956
+ };
26957
+ const onPageMessage = (e) => {
26958
+ if (e.data?.type === "ow:page-created") {
26959
+ const { path, title } = e.data;
26960
+ if (typeof path !== "string" || !path) return;
26961
+ if (addNavLinkForPage({ path, title: typeof title === "string" && title ? title : path }, deps)) {
26962
+ enforceLinkHrefs();
26963
+ }
26964
+ return;
26965
+ }
26966
+ if (e.data?.type === "ow:page-renamed") {
26967
+ const { oldPath, newPath, oldTitle, newTitle } = e.data;
26968
+ if (typeof oldPath !== "string" || typeof newPath !== "string") return;
26969
+ const moved = retargetPageLinks(
26970
+ {
26971
+ oldPath,
26972
+ newPath,
26973
+ oldTitle: typeof oldTitle === "string" ? oldTitle : void 0,
26974
+ newTitle: typeof newTitle === "string" ? newTitle : void 0
26975
+ },
26976
+ deps
26977
+ );
26978
+ if (moved > 0) enforceLinkHrefs();
26979
+ }
26980
+ };
26981
+ window.addEventListener("message", onPageMessage);
26982
+ return () => window.removeEventListener("message", onPageMessage);
26983
+ }, [isEditMode, postToParent2]);
26984
+ (0, import_react24.useEffect)(() => {
26520
26985
  if (!isEditMode || shouldUseDevFixtures()) return;
26521
26986
  void loadAllSectionsManifest().then((manifest) => {
26522
26987
  if (Object.keys(manifest).length === 0) return;
26523
26988
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
26524
26989
  });
26525
26990
  }, [isEditMode]);
26526
- (0, import_react23.useEffect)(() => {
26991
+ (0, import_react24.useEffect)(() => {
26527
26992
  const update = () => {
26528
26993
  const el = activeElRef.current ?? selectedElRef.current;
26529
26994
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -26547,10 +27012,10 @@ function OhhwellsBridge() {
26547
27012
  vvp.removeEventListener("resize", update);
26548
27013
  };
26549
27014
  }, []);
26550
- const refreshStateRules = (0, import_react23.useCallback)(() => {
27015
+ const refreshStateRules = (0, import_react24.useCallback)(() => {
26551
27016
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
26552
27017
  }, []);
26553
- const processConfigRequest = (0, import_react23.useCallback)((insertAfterVal) => {
27018
+ const processConfigRequest = (0, import_react24.useCallback)((insertAfterVal) => {
26554
27019
  const tracker = getSectionsTracker();
26555
27020
  let entries = [];
26556
27021
  try {
@@ -26573,7 +27038,7 @@ function OhhwellsBridge() {
26573
27038
  }
26574
27039
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
26575
27040
  }, [isEditMode]);
26576
- const deactivate = (0, import_react23.useCallback)(() => {
27041
+ const deactivate = (0, import_react24.useCallback)(() => {
26577
27042
  const el = activeElRef.current;
26578
27043
  if (!el) return;
26579
27044
  const isFormBlock = el.dataset.ohwEditable === "form";
@@ -26639,12 +27104,12 @@ function OhhwellsBridge() {
26639
27104
  setToolbarShowEditLink(false);
26640
27105
  postToParent2({ type: "ow:exit-edit" });
26641
27106
  }, [postToParent2]);
26642
- const clearSelectedAttr = (0, import_react23.useCallback)(() => {
27107
+ const clearSelectedAttr = (0, import_react24.useCallback)(() => {
26643
27108
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
26644
27109
  el.removeAttribute("data-ohw-selected");
26645
27110
  });
26646
27111
  }, []);
26647
- const deselect = (0, import_react23.useCallback)(() => {
27112
+ const deselect = (0, import_react24.useCallback)(() => {
26648
27113
  const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
26649
27114
  clearSelectedAttr();
26650
27115
  selectedElRef.current = null;
@@ -26680,20 +27145,20 @@ function OhhwellsBridge() {
26680
27145
  setToolbarVariant("none");
26681
27146
  }
26682
27147
  }, [clearSelectedAttr]);
26683
- const markSelected = (0, import_react23.useCallback)((el) => {
27148
+ const markSelected = (0, import_react24.useCallback)((el) => {
26684
27149
  clearSelectedAttr();
26685
27150
  el.removeAttribute("data-ohw-hovered");
26686
27151
  el.setAttribute("data-ohw-selected", "");
26687
27152
  }, [clearSelectedAttr]);
26688
- const isSelectedForHover = (0, import_react23.useCallback)((el) => {
27153
+ const isSelectedForHover = (0, import_react24.useCallback)((el) => {
26689
27154
  if (!el) return false;
26690
27155
  return [selectedElRef.current, activeElRef.current].some(
26691
27156
  (busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
26692
27157
  );
26693
27158
  }, []);
26694
- const isSelectedForHoverRef = (0, import_react23.useRef)(isSelectedForHover);
27159
+ const isSelectedForHoverRef = (0, import_react24.useRef)(isSelectedForHover);
26695
27160
  isSelectedForHoverRef.current = isSelectedForHover;
26696
- const resolveHrefKeyElement = (0, import_react23.useCallback)((hrefKey) => {
27161
+ const resolveHrefKeyElement = (0, import_react24.useCallback)((hrefKey) => {
26697
27162
  if (isFooterHrefKey(hrefKey)) {
26698
27163
  return document.querySelector(
26699
27164
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -26708,7 +27173,7 @@ function OhhwellsBridge() {
26708
27173
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
26709
27174
  );
26710
27175
  }, []);
26711
- const resyncSelectedNavigationItem = (0, import_react23.useCallback)(() => {
27176
+ const resyncSelectedNavigationItem = (0, import_react24.useCallback)(() => {
26712
27177
  const hrefKey = selectedHrefKeyRef.current;
26713
27178
  if (hrefKey) {
26714
27179
  const link = resolveHrefKeyElement(hrefKey);
@@ -26746,7 +27211,7 @@ function OhhwellsBridge() {
26746
27211
  );
26747
27212
  }
26748
27213
  }, [resolveHrefKeyElement]);
26749
- const reselectNavigationItem = (0, import_react23.useCallback)((navAnchor) => {
27214
+ const reselectNavigationItem = (0, import_react24.useCallback)((navAnchor) => {
26750
27215
  selectedElRef.current = navAnchor;
26751
27216
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
26752
27217
  selectedFooterColAttrRef.current = null;
@@ -26777,7 +27242,7 @@ function OhhwellsBridge() {
26777
27242
  setToolbarShowEditLink(false);
26778
27243
  setActiveCommands(/* @__PURE__ */ new Set());
26779
27244
  }, [markSelected]);
26780
- const commitNavigationTextEdit = (0, import_react23.useCallback)((navAnchor) => {
27245
+ const commitNavigationTextEdit = (0, import_react24.useCallback)((navAnchor) => {
26781
27246
  const el = activeElRef.current;
26782
27247
  if (!el) return;
26783
27248
  const key = el.dataset.ohwKey;
@@ -26810,7 +27275,7 @@ function OhhwellsBridge() {
26810
27275
  postToParent2({ type: "ow:exit-edit" });
26811
27276
  reselectNavigationItem(navAnchor);
26812
27277
  }, [postToParent2, reselectNavigationItem]);
26813
- const handleAddTopLevelNavItem = (0, import_react23.useCallback)(() => {
27278
+ const handleAddTopLevelNavItem = (0, import_react24.useCallback)(() => {
26814
27279
  const items = listNavbarRootItems();
26815
27280
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
26816
27281
  deselectRef.current();
@@ -26822,7 +27287,7 @@ function OhhwellsBridge() {
26822
27287
  intent: "add-nav"
26823
27288
  });
26824
27289
  }, []);
26825
- const maybeWarnNavLinkDropdownConflict = (0, import_react23.useCallback)(
27290
+ const maybeWarnNavLinkDropdownConflict = (0, import_react24.useCallback)(
26826
27291
  (anchor) => {
26827
27292
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
26828
27293
  if (!navDropdownsOpenOnClick()) return;
@@ -26835,7 +27300,7 @@ function OhhwellsBridge() {
26835
27300
  },
26836
27301
  [postToParent2]
26837
27302
  );
26838
- const handleNavDropdownOpenChange = (0, import_react23.useCallback)((open) => {
27303
+ const handleNavDropdownOpenChange = (0, import_react24.useCallback)((open) => {
26839
27304
  const selected = selectedElRef.current;
26840
27305
  if (!selected || !isNavigationItem2(selected)) return;
26841
27306
  if (isNestedNavChild(selected)) return;
@@ -26851,7 +27316,7 @@ function OhhwellsBridge() {
26851
27316
  }
26852
27317
  });
26853
27318
  }, []);
26854
- const handleFooterHeadingVisibleChange = (0, import_react23.useCallback)(
27319
+ const handleFooterHeadingVisibleChange = (0, import_react24.useCallback)(
26855
27320
  (visible) => {
26856
27321
  const selected = selectedElRef.current;
26857
27322
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -26904,7 +27369,7 @@ function OhhwellsBridge() {
26904
27369
  },
26905
27370
  [postToParent2]
26906
27371
  );
26907
- const enterEditOnNewItem = (0, import_react23.useCallback)((anchor) => {
27372
+ const enterEditOnNewItem = (0, import_react24.useCallback)((anchor) => {
26908
27373
  const label = anchor.querySelector('[data-ohw-editable="text"]');
26909
27374
  if (!label) {
26910
27375
  selectRef.current(anchor);
@@ -26913,8 +27378,8 @@ function OhhwellsBridge() {
26913
27378
  setNavGroupForceOpen(anchor, true);
26914
27379
  activateRef.current(label);
26915
27380
  }, []);
26916
- const pendingSocialAddRef = (0, import_react23.useRef)(null);
26917
- const handleAddChildItem = (0, import_react23.useCallback)(() => {
27381
+ const pendingSocialAddRef = (0, import_react24.useRef)(null);
27382
+ const handleAddChildItem = (0, import_react24.useCallback)(() => {
26918
27383
  const selected = selectedElRef.current;
26919
27384
  if (!selected) return;
26920
27385
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
@@ -27041,7 +27506,7 @@ function OhhwellsBridge() {
27041
27506
  });
27042
27507
  });
27043
27508
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
27044
- const handleAddFooterColumn = (0, import_react23.useCallback)(() => {
27509
+ const handleAddFooterColumn = (0, import_react24.useCallback)(() => {
27045
27510
  if (document.querySelector("[data-ai-footer]")) {
27046
27511
  const state = parseAiFooterState(aiFooterRef.current);
27047
27512
  if (!state?.tree) return;
@@ -27097,7 +27562,7 @@ function OhhwellsBridge() {
27097
27562
  selectRef.current(result.firstLink);
27098
27563
  });
27099
27564
  }, [postToParent2]);
27100
- const clearFooterDragVisuals = (0, import_react23.useCallback)(() => {
27565
+ const clearFooterDragVisuals = (0, import_react24.useCallback)(() => {
27101
27566
  footerDragRef.current = null;
27102
27567
  setSiblingHintRects([]);
27103
27568
  setFooterDropSlots([]);
@@ -27106,7 +27571,7 @@ function OhhwellsBridge() {
27106
27571
  setIsItemDragging(false);
27107
27572
  unlockFooterDragInteraction();
27108
27573
  }, []);
27109
- const refreshFooterDragVisuals = (0, import_react23.useCallback)((session, activeSlot, clientX, clientY) => {
27574
+ const refreshFooterDragVisuals = (0, import_react24.useCallback)((session, activeSlot, clientX, clientY) => {
27110
27575
  const dragged = session.draggedEl;
27111
27576
  setDraggedItemRect(dragged.getBoundingClientRect());
27112
27577
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -27138,13 +27603,13 @@ function OhhwellsBridge() {
27138
27603
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
27139
27604
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
27140
27605
  }, []);
27141
- const refreshFooterDragVisualsRef = (0, import_react23.useRef)(refreshFooterDragVisuals);
27606
+ const refreshFooterDragVisualsRef = (0, import_react24.useRef)(refreshFooterDragVisuals);
27142
27607
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
27143
- const commitFooterDragRef = (0, import_react23.useRef)(() => {
27608
+ const commitFooterDragRef = (0, import_react24.useRef)(() => {
27144
27609
  });
27145
- const beginFooterDragRef = (0, import_react23.useRef)(() => {
27610
+ const beginFooterDragRef = (0, import_react24.useRef)(() => {
27146
27611
  });
27147
- const beginFooterDrag = (0, import_react23.useCallback)(
27612
+ const beginFooterDrag = (0, import_react24.useCallback)(
27148
27613
  (session) => {
27149
27614
  const rect = session.draggedEl.getBoundingClientRect();
27150
27615
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -27164,7 +27629,7 @@ function OhhwellsBridge() {
27164
27629
  [refreshFooterDragVisuals]
27165
27630
  );
27166
27631
  beginFooterDragRef.current = beginFooterDrag;
27167
- const commitFooterDrag = (0, import_react23.useCallback)(
27632
+ const commitFooterDrag = (0, import_react24.useCallback)(
27168
27633
  (clientX, clientY) => {
27169
27634
  const session = footerDragRef.current;
27170
27635
  if (!session) {
@@ -27336,7 +27801,7 @@ function OhhwellsBridge() {
27336
27801
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
27337
27802
  );
27338
27803
  commitFooterDragRef.current = commitFooterDrag;
27339
- const startFooterLinkDrag = (0, import_react23.useCallback)(
27804
+ const startFooterLinkDrag = (0, import_react24.useCallback)(
27340
27805
  (anchor, clientX, clientY, wasSelected) => {
27341
27806
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
27342
27807
  if (!hrefKey) return false;
@@ -27372,7 +27837,7 @@ function OhhwellsBridge() {
27372
27837
  },
27373
27838
  [beginFooterDrag]
27374
27839
  );
27375
- const startFooterColumnDrag = (0, import_react23.useCallback)(
27840
+ const startFooterColumnDrag = (0, import_react24.useCallback)(
27376
27841
  (columnEl, clientX, clientY, wasSelected) => {
27377
27842
  const columns = listFooterColumns(columnEl);
27378
27843
  const idx = columns.indexOf(columnEl);
@@ -27392,7 +27857,7 @@ function OhhwellsBridge() {
27392
27857
  },
27393
27858
  [beginFooterDrag]
27394
27859
  );
27395
- const persistButtonCollectionDrag = (0, import_react23.useCallback)(
27860
+ const persistButtonCollectionDrag = (0, import_react24.useCallback)(
27396
27861
  (button, clientX) => {
27397
27862
  const insertIndex = buttonDropInsertIndexRef.current;
27398
27863
  if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
@@ -27416,7 +27881,7 @@ function OhhwellsBridge() {
27416
27881
  },
27417
27882
  [postToParent2]
27418
27883
  );
27419
- const refreshButtonDragVisuals = (0, import_react23.useCallback)((button, clientX, clientY) => {
27884
+ const refreshButtonDragVisuals = (0, import_react24.useCallback)((button, clientX, clientY) => {
27420
27885
  const collection = buttonCollectionOf(button);
27421
27886
  if (!collection) {
27422
27887
  setButtonDropSlots([]);
@@ -27433,7 +27898,7 @@ function OhhwellsBridge() {
27433
27898
  setDraggedItemRect(button.getBoundingClientRect());
27434
27899
  if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
27435
27900
  }, []);
27436
- const handleItemDragStart = (0, import_react23.useCallback)(
27901
+ const handleItemDragStart = (0, import_react24.useCallback)(
27437
27902
  (e) => {
27438
27903
  const selected = selectedElRef.current;
27439
27904
  if (!selected) {
@@ -27464,7 +27929,7 @@ function OhhwellsBridge() {
27464
27929
  },
27465
27930
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
27466
27931
  );
27467
- const handleItemDragEnd = (0, import_react23.useCallback)(
27932
+ const handleItemDragEnd = (0, import_react24.useCallback)(
27468
27933
  (e) => {
27469
27934
  const collectionButton = buttonCollectionDragRef.current;
27470
27935
  if (collectionButton) {
@@ -27495,7 +27960,7 @@ function OhhwellsBridge() {
27495
27960
  },
27496
27961
  [commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
27497
27962
  );
27498
- const handleItemChromePointerDown = (0, import_react23.useCallback)((e) => {
27963
+ const handleItemChromePointerDown = (0, import_react24.useCallback)((e) => {
27499
27964
  if (e.button !== 0) return;
27500
27965
  const selected = selectedElRef.current;
27501
27966
  if (!selected) return;
@@ -27536,7 +28001,7 @@ function OhhwellsBridge() {
27536
28001
  }
27537
28002
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
27538
28003
  }, [armNavPressFromChrome]);
27539
- const handleItemChromeClick = (0, import_react23.useCallback)((clientX, clientY) => {
28004
+ const handleItemChromeClick = (0, import_react24.useCallback)((clientX, clientY) => {
27540
28005
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
27541
28006
  suppressNextClickRef.current = false;
27542
28007
  return;
@@ -27549,7 +28014,7 @@ function OhhwellsBridge() {
27549
28014
  }, []);
27550
28015
  reselectNavigationItemRef.current = reselectNavigationItem;
27551
28016
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
27552
- const select = (0, import_react23.useCallback)((anchor) => {
28017
+ const select = (0, import_react24.useCallback)((anchor) => {
27553
28018
  if (!isNavigationItem2(anchor)) return;
27554
28019
  if (activeElRef.current) deactivate();
27555
28020
  clearSocialSelectionRef.current();
@@ -27626,7 +28091,7 @@ function OhhwellsBridge() {
27626
28091
  setLogoSizeDraft(null);
27627
28092
  }
27628
28093
  }, [deactivate, markSelected]);
27629
- const selectFrame = (0, import_react23.useCallback)((el) => {
28094
+ const selectFrame = (0, import_react24.useCallback)((el) => {
27630
28095
  if (!isNavigationContainer(el)) return;
27631
28096
  if (activeElRef.current) deactivate();
27632
28097
  aiSectionApiRef.current?.selectFromElement(el);
@@ -27667,7 +28132,7 @@ function OhhwellsBridge() {
27667
28132
  setFloatingPanelPos(null);
27668
28133
  setLogoSizeDraft(null);
27669
28134
  }, [deactivate, markSelected, postToParent2]);
27670
- const selectLogo = (0, import_react23.useCallback)(
28135
+ const selectLogo = (0, import_react24.useCallback)(
27671
28136
  (logoEl) => {
27672
28137
  if (activeElRef.current) deactivate();
27673
28138
  selectedElRef.current = logoEl;
@@ -27696,7 +28161,7 @@ function OhhwellsBridge() {
27696
28161
  },
27697
28162
  [deactivate, markSelected]
27698
28163
  );
27699
- const openLogoSizePanel = (0, import_react23.useCallback)((logoEl) => {
28164
+ const openLogoSizePanel = (0, import_react24.useCallback)((logoEl) => {
27700
28165
  const placement = getLogoPlacement(logoEl);
27701
28166
  const draft = readLogoSizeState(editContentRef.current, placement);
27702
28167
  setLogoSizeDraft(draft);
@@ -27709,7 +28174,7 @@ function OhhwellsBridge() {
27709
28174
  placement
27710
28175
  });
27711
28176
  }, []);
27712
- const openSocialsDisplayPanel = (0, import_react23.useCallback)((row) => {
28177
+ const openSocialsDisplayPanel = (0, import_react24.useCallback)((row) => {
27713
28178
  setFloatingPanelPos(null);
27714
28179
  setParentScrollSnap(parentScrollRef.current);
27715
28180
  setFloatingPanel({
@@ -27720,7 +28185,7 @@ function OhhwellsBridge() {
27720
28185
  row
27721
28186
  });
27722
28187
  }, []);
27723
- const rememberButtonTokens = (0, import_react23.useCallback)(
28188
+ const rememberButtonTokens = (0, import_react24.useCallback)(
27724
28189
  (content, tokens, nodes) => {
27725
28190
  if (nodes.length === 0) return content;
27726
28191
  const next = { ...content };
@@ -27731,7 +28196,7 @@ function OhhwellsBridge() {
27731
28196
  },
27732
28197
  [postToParent2]
27733
28198
  );
27734
- const tokensForButton = (0, import_react23.useCallback)(
28199
+ const tokensForButton = (0, import_react24.useCallback)(
27735
28200
  (el, persistFallback = false) => {
27736
28201
  const stored = readStoredStyleTokens(editContentRef.current);
27737
28202
  if (stored) return stored;
@@ -27746,7 +28211,7 @@ function OhhwellsBridge() {
27746
28211
  },
27747
28212
  [rememberButtonTokens]
27748
28213
  );
27749
- const openButtonStylePanel = (0, import_react23.useCallback)(
28214
+ const openButtonStylePanel = (0, import_react24.useCallback)(
27750
28215
  (anchor) => {
27751
28216
  const id = buttonId(anchor);
27752
28217
  if (!id) return;
@@ -27764,7 +28229,7 @@ function OhhwellsBridge() {
27764
28229
  },
27765
28230
  [tokensForButton]
27766
28231
  );
27767
- const applySelectedButtonStyle = (0, import_react23.useCallback)(
28232
+ const applySelectedButtonStyle = (0, import_react24.useCallback)(
27768
28233
  (patch) => {
27769
28234
  const panel = floatingPanelRef.current;
27770
28235
  const id = panel?.kind === "button-style" ? panel.buttonId : null;
@@ -27782,7 +28247,7 @@ function OhhwellsBridge() {
27782
28247
  },
27783
28248
  [postToParent2]
27784
28249
  );
27785
- (0, import_react23.useEffect)(() => {
28250
+ (0, import_react24.useEffect)(() => {
27786
28251
  const onDragOver = (e) => {
27787
28252
  const dragged = buttonCollectionDragRef.current;
27788
28253
  if (!dragged) return;
@@ -27801,11 +28266,11 @@ function OhhwellsBridge() {
27801
28266
  document.removeEventListener("drop", onDrop);
27802
28267
  };
27803
28268
  }, [refreshButtonDragVisuals]);
27804
- const isEditModeRef = (0, import_react23.useRef)(false);
27805
- const requestMissingSocialIconsRef = (0, import_react23.useRef)(() => {
28269
+ const isEditModeRef = (0, import_react24.useRef)(false);
28270
+ const requestMissingSocialIconsRef = (0, import_react24.useRef)(() => {
27806
28271
  });
27807
- const askedSocialIconsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
27808
- const requestMissingSocialIcons = (0, import_react23.useCallback)(() => {
28272
+ const askedSocialIconsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
28273
+ const requestMissingSocialIcons = (0, import_react24.useCallback)(() => {
27809
28274
  const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
27810
28275
  const missing = socialsMissingIcons(row);
27811
28276
  listSocialItems(row).forEach((item) => ensureIconSlot(item));
@@ -27817,7 +28282,7 @@ function OhhwellsBridge() {
27817
28282
  }, []);
27818
28283
  requestMissingSocialIconsRef.current = requestMissingSocialIcons;
27819
28284
  isEditModeRef.current = isEditMode;
27820
- const changeSocialsDisplay = (0, import_react23.useCallback)(
28285
+ const changeSocialsDisplay = (0, import_react24.useCallback)(
27821
28286
  (row, next) => {
27822
28287
  if (next.icon) {
27823
28288
  const missing = socialsMissingIcons(row);
@@ -27841,19 +28306,19 @@ function OhhwellsBridge() {
27841
28306
  },
27842
28307
  []
27843
28308
  );
27844
- const closeFloatingPanelOnly = (0, import_react23.useCallback)(() => {
28309
+ const closeFloatingPanelOnly = (0, import_react24.useCallback)(() => {
27845
28310
  setFloatingPanel(null);
27846
28311
  setFloatingPanelPos(null);
27847
28312
  setLogoSizeDraft(null);
27848
28313
  }, []);
27849
28314
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
27850
- const closeFloatingPanelAndDeselect = (0, import_react23.useCallback)(() => {
28315
+ const closeFloatingPanelAndDeselect = (0, import_react24.useCallback)(() => {
27851
28316
  setFloatingPanel(null);
27852
28317
  setFloatingPanelPos(null);
27853
28318
  setLogoSizeDraft(null);
27854
28319
  deselectRef.current();
27855
28320
  }, []);
27856
- (0, import_react23.useEffect)(() => {
28321
+ (0, import_react24.useEffect)(() => {
27857
28322
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
27858
28323
  if (!session || !logoSizeDraft) {
27859
28324
  postToParentRef.current({ type: "ow:logo-size-panel", open: false });
@@ -27872,7 +28337,7 @@ function OhhwellsBridge() {
27872
28337
  max: LOGO_SIZE_MAX
27873
28338
  });
27874
28339
  }, [floatingPanel, logoSizeDraft, editorViewport]);
27875
- const persistLogoSizeDraft = (0, import_react23.useCallback)(
28340
+ const persistLogoSizeDraft = (0, import_react24.useCallback)(
27876
28341
  (placement, draft) => {
27877
28342
  const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
27878
28343
  const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
@@ -27912,7 +28377,7 @@ function OhhwellsBridge() {
27912
28377
  },
27913
28378
  [postToParent2]
27914
28379
  );
27915
- const activate = (0, import_react23.useCallback)((el, options) => {
28380
+ const activate = (0, import_react24.useCallback)((el, options) => {
27916
28381
  if (activeElRef.current === el) return;
27917
28382
  document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
27918
28383
  hovered.removeAttribute("data-ohw-hovered");
@@ -28010,8 +28475,8 @@ function OhhwellsBridge() {
28010
28475
  openLogoSizePanelRef.current = openLogoSizePanel;
28011
28476
  deselectRef.current = deselect;
28012
28477
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
28013
- const lastSiteWideScopeRef = (0, import_react23.useRef)(null);
28014
- (0, import_react23.useEffect)(() => {
28478
+ const lastSiteWideScopeRef = (0, import_react24.useRef)(null);
28479
+ (0, import_react24.useEffect)(() => {
28015
28480
  if (!isEditMode) {
28016
28481
  if (lastSiteWideScopeRef.current !== false) {
28017
28482
  lastSiteWideScopeRef.current = false;
@@ -28037,7 +28502,7 @@ function OhhwellsBridge() {
28037
28502
  isFooterFrameSelection,
28038
28503
  postToParent2
28039
28504
  ]);
28040
- (0, import_react23.useLayoutEffect)(() => {
28505
+ (0, import_react24.useLayoutEffect)(() => {
28041
28506
  if (!subdomain || isEditMode) {
28042
28507
  setFetchState("done");
28043
28508
  return;
@@ -28064,6 +28529,7 @@ function OhhwellsBridge() {
28064
28529
  applyAiFooterFromContent(content);
28065
28530
  if (typeof content[STYLE_STORE_KEY] === "string") {
28066
28531
  stylesRef.current = content[STYLE_STORE_KEY];
28532
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28067
28533
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28068
28534
  }
28069
28535
  applyBrandChrome(content);
@@ -28074,15 +28540,16 @@ function OhhwellsBridge() {
28074
28540
  if (key === "__ohw_sections") continue;
28075
28541
  if (key === AI_SECTIONS_KEY) continue;
28076
28542
  if (key === AI_FOOTER_KEY) continue;
28543
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28544
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28077
28545
  if (key === BRAND_KIT_KEY) continue;
28078
28546
  if (key === STYLE_STORE_KEY) continue;
28079
28547
  if (BRAND_CHROME_KEYS.has(key)) continue;
28080
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28081
28548
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28082
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28083
28549
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28084
28550
  continue;
28085
28551
  }
28552
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28086
28553
  if (applyVideoSettingNode(key, val)) continue;
28087
28554
  if (applyCarouselNode(key, val)) continue;
28088
28555
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28122,6 +28589,7 @@ function OhhwellsBridge() {
28122
28589
  });
28123
28590
  applyLinkByKey(key, val);
28124
28591
  }
28592
+ applySectionEmbeds(content);
28125
28593
  applyLogoFromContent(content);
28126
28594
  applyLogoSizes(content);
28127
28595
  reconcileNavbarItemsFromContent(content);
@@ -28188,7 +28656,7 @@ function OhhwellsBridge() {
28188
28656
  cancelled = true;
28189
28657
  };
28190
28658
  }, [subdomain, isEditMode]);
28191
- (0, import_react23.useEffect)(() => {
28659
+ (0, import_react24.useEffect)(() => {
28192
28660
  if (!isEditMode) return;
28193
28661
  const resolveIndex = (form, clientY) => {
28194
28662
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -28229,7 +28697,7 @@ function OhhwellsBridge() {
28229
28697
  window.removeEventListener("drop", onDrop, true);
28230
28698
  };
28231
28699
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
28232
- (0, import_react23.useEffect)(() => {
28700
+ (0, import_react24.useEffect)(() => {
28233
28701
  if (!isEditMode) return;
28234
28702
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28235
28703
  markFormFields(form);
@@ -28241,7 +28709,7 @@ function OhhwellsBridge() {
28241
28709
  });
28242
28710
  return () => observer.disconnect();
28243
28711
  }, [isEditMode, fetchState, pathname]);
28244
- (0, import_react23.useEffect)(() => {
28712
+ (0, import_react24.useEffect)(() => {
28245
28713
  if (!isEditMode) return;
28246
28714
  let saveTimer = null;
28247
28715
  const onInput = (e) => {
@@ -28263,14 +28731,14 @@ function OhhwellsBridge() {
28263
28731
  document.addEventListener("input", onInput, true);
28264
28732
  return () => document.removeEventListener("input", onInput, true);
28265
28733
  }, [isEditMode, persistFields]);
28266
- (0, import_react23.useEffect)(() => {
28734
+ (0, import_react24.useEffect)(() => {
28267
28735
  if (isEditMode || fetchState !== "done") return;
28268
28736
  const content = contentCache.get(subdomain) ?? {};
28269
28737
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28270
28738
  reconcileFieldsFromContent(form, content);
28271
28739
  });
28272
28740
  }, [isEditMode, fetchState, subdomain]);
28273
- (0, import_react23.useEffect)(() => {
28741
+ (0, import_react24.useEffect)(() => {
28274
28742
  if (!isEditMode) return;
28275
28743
  const swallow = (e) => {
28276
28744
  const target = e.target;
@@ -28279,14 +28747,14 @@ function OhhwellsBridge() {
28279
28747
  document.addEventListener("submit", swallow, true);
28280
28748
  return () => document.removeEventListener("submit", swallow, true);
28281
28749
  }, [isEditMode]);
28282
- (0, import_react23.useEffect)(() => {
28750
+ (0, import_react24.useEffect)(() => {
28283
28751
  if (isEditMode || fetchState !== "done") return;
28284
28752
  console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
28285
28753
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
28286
28754
  console.log({ apiUrl, subdomain });
28287
28755
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
28288
28756
  }, [isEditMode, fetchState, subdomain]);
28289
- (0, import_react23.useEffect)(() => {
28757
+ (0, import_react24.useEffect)(() => {
28290
28758
  if (!subdomain || isEditMode) return;
28291
28759
  let debounceTimer = null;
28292
28760
  let observer = null;
@@ -28310,20 +28778,22 @@ function OhhwellsBridge() {
28310
28778
  }
28311
28779
  applyAiFooterFromContent(content);
28312
28780
  if (typeof content[STYLE_STORE_KEY] === "string") {
28781
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28313
28782
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28314
28783
  }
28315
28784
  for (const [key, val] of Object.entries(content)) {
28316
28785
  if (key === "__ohw_sections") continue;
28317
28786
  if (key === AI_SECTIONS_KEY) continue;
28318
28787
  if (key === AI_FOOTER_KEY) continue;
28788
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28789
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28319
28790
  if (key === BRAND_KIT_KEY) continue;
28320
28791
  if (key === STYLE_STORE_KEY) continue;
28321
28792
  if (BRAND_CHROME_KEYS.has(key)) continue;
28322
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28323
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28324
28793
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28325
28794
  continue;
28326
28795
  }
28796
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28327
28797
  if (applyVideoSettingNode(key, val)) continue;
28328
28798
  if (applyCarouselNode(key, val)) continue;
28329
28799
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28348,6 +28818,7 @@ function OhhwellsBridge() {
28348
28818
  });
28349
28819
  applyLinkByKey(key, val);
28350
28820
  }
28821
+ applySectionEmbeds(content);
28351
28822
  applyLogoFromContent(content);
28352
28823
  reconcileNavbarItemsFromContent(content);
28353
28824
  reconcileFooterOrderFromContent(content);
@@ -28403,16 +28874,16 @@ function OhhwellsBridge() {
28403
28874
  if (debounceTimer) clearTimeout(debounceTimer);
28404
28875
  };
28405
28876
  }, [subdomain, isEditMode, pathname]);
28406
- (0, import_react23.useLayoutEffect)(() => {
28877
+ (0, import_react24.useLayoutEffect)(() => {
28407
28878
  const el = document.getElementById("ohw-loader");
28408
28879
  if (!el) return;
28409
28880
  const visible = Boolean(subdomain) && fetchState !== "done";
28410
28881
  el.style.display = visible ? "flex" : "none";
28411
28882
  }, [subdomain, fetchState]);
28412
- (0, import_react23.useEffect)(() => {
28883
+ (0, import_react24.useEffect)(() => {
28413
28884
  postToParent2({ type: "ow:navigation", path: pathname });
28414
28885
  }, [pathname, postToParent2]);
28415
- (0, import_react23.useEffect)(() => {
28886
+ (0, import_react24.useEffect)(() => {
28416
28887
  if (!subdomain || isEditMode) return;
28417
28888
  const content = contentCache.get(subdomain);
28418
28889
  if (!content) return;
@@ -28430,7 +28901,7 @@ function OhhwellsBridge() {
28430
28901
  }
28431
28902
  applyAiFooterFromContent(content);
28432
28903
  }, [pathname, subdomain, isEditMode]);
28433
- (0, import_react23.useEffect)(() => {
28904
+ (0, import_react24.useEffect)(() => {
28434
28905
  if (!isEditMode) return;
28435
28906
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
28436
28907
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -28438,12 +28909,12 @@ function OhhwellsBridge() {
28438
28909
  deselectRef.current();
28439
28910
  deactivateRef.current();
28440
28911
  }, [pathname, isEditMode]);
28441
- (0, import_react23.useEffect)(() => {
28912
+ (0, import_react24.useEffect)(() => {
28442
28913
  if (!isEditMode) return;
28443
28914
  initSectionInstancesFromContent(editContentRef.current, pathname);
28444
28915
  initItemInstancesFromContent(editContentRef.current);
28445
28916
  }, [pathname, isEditMode]);
28446
- (0, import_react23.useEffect)(() => {
28917
+ (0, import_react24.useEffect)(() => {
28447
28918
  if (!isEditMode) return;
28448
28919
  const observer = new MutationObserver(() => {
28449
28920
  const drawer = document.querySelector("[data-ohw-nav-drawer]");
@@ -28454,7 +28925,7 @@ function OhhwellsBridge() {
28454
28925
  observer.observe(document.body, { childList: true, subtree: true });
28455
28926
  return () => observer.disconnect();
28456
28927
  }, [isEditMode, pathname]);
28457
- (0, import_react23.useEffect)(() => {
28928
+ (0, import_react24.useEffect)(() => {
28458
28929
  const contentForNav = () => {
28459
28930
  if (isEditMode) return editContentRef.current;
28460
28931
  if (!subdomain) return {};
@@ -28527,7 +28998,7 @@ function OhhwellsBridge() {
28527
28998
  observer?.disconnect();
28528
28999
  };
28529
29000
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
28530
- (0, import_react23.useEffect)(() => {
29001
+ (0, import_react24.useEffect)(() => {
28531
29002
  if (!isEditMode) return;
28532
29003
  let applying = false;
28533
29004
  let rafId = null;
@@ -28565,7 +29036,7 @@ function OhhwellsBridge() {
28565
29036
  observer.disconnect();
28566
29037
  };
28567
29038
  }, [isEditMode, pathname]);
28568
- (0, import_react23.useEffect)(() => {
29039
+ (0, import_react24.useEffect)(() => {
28569
29040
  if (!isEditMode) return;
28570
29041
  let lastPosted = 0;
28571
29042
  const measure = () => {
@@ -28587,29 +29058,14 @@ function OhhwellsBridge() {
28587
29058
  const t2 = setTimeout(measure, 500);
28588
29059
  const ro = new ResizeObserver(schedule);
28589
29060
  ro.observe(document.body);
28590
- let lastWidth = window.innerWidth;
28591
- let resizeTimers = [];
28592
- const clearResizeTimers = () => {
28593
- resizeTimers.forEach(clearTimeout);
28594
- resizeTimers = [];
28595
- };
28596
- const handleResize = () => {
28597
- if (window.innerWidth === lastWidth) return;
28598
- lastWidth = window.innerWidth;
28599
- clearResizeTimers();
28600
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
28601
- };
28602
- window.addEventListener("resize", handleResize);
28603
29061
  return () => {
28604
29062
  clearTimeout(t1);
28605
29063
  clearTimeout(t2);
28606
29064
  if (raf != null) cancelAnimationFrame(raf);
28607
29065
  ro.disconnect();
28608
- clearResizeTimers();
28609
- window.removeEventListener("resize", handleResize);
28610
29066
  };
28611
29067
  }, [pathname, isEditMode, postToParent2]);
28612
- (0, import_react23.useEffect)(() => {
29068
+ (0, import_react24.useEffect)(() => {
28613
29069
  if (isEditMode) return;
28614
29070
  const handleClick = (e) => {
28615
29071
  if (!isPlainLeftClick(e)) return;
@@ -28623,7 +29079,7 @@ function OhhwellsBridge() {
28623
29079
  document.addEventListener("click", handleClick, true);
28624
29080
  return () => document.removeEventListener("click", handleClick, true);
28625
29081
  }, [isEditMode, router, pathname]);
28626
- (0, import_react23.useEffect)(() => {
29082
+ (0, import_react24.useEffect)(() => {
28627
29083
  if (!isEditMode) {
28628
29084
  editStylesRef.current?.base.remove();
28629
29085
  editStylesRef.current?.forceHover.remove();
@@ -28903,6 +29359,13 @@ function OhhwellsBridge() {
28903
29359
  if (target.closest("[data-ohw-state-toggle]")) return;
28904
29360
  if (target.closest("[data-ohw-max-badge]")) return;
28905
29361
  if (isInsideLinkEditor(target)) return;
29362
+ if (isInsideFloatingPanel(target)) return;
29363
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29364
+ if (target.closest(
29365
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29366
+ )) {
29367
+ return;
29368
+ }
28906
29369
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
28907
29370
  clearMediaSelectionRef.current();
28908
29371
  }
@@ -28926,8 +29389,6 @@ function OhhwellsBridge() {
28926
29389
  return;
28927
29390
  }
28928
29391
  }
28929
- if (isInsideFloatingPanel(target)) return;
28930
- if (target.closest("[data-ohw-form-toolbar]")) return;
28931
29392
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
28932
29393
  if (collectionItem) {
28933
29394
  e.preventDefault();
@@ -28939,11 +29400,6 @@ function OhhwellsBridge() {
28939
29400
  });
28940
29401
  return;
28941
29402
  }
28942
- if (target.closest(
28943
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
28944
- )) {
28945
- return;
28946
- }
28947
29403
  {
28948
29404
  const formEl = getFormElement(target);
28949
29405
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29097,9 +29553,13 @@ function OhhwellsBridge() {
29097
29553
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29098
29554
  e.preventDefault();
29099
29555
  e.stopPropagation();
29100
- selectIconElementRef.current(editable);
29101
29556
  const aiIcon = editable.hasAttribute("data-ai-icon");
29102
29557
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29558
+ if (aiIcon) {
29559
+ aiSectionApiRef.current?.selectFromElement(editable);
29560
+ } else {
29561
+ selectIconElementRef.current(editable);
29562
+ }
29103
29563
  postToParentRef.current({
29104
29564
  type: "ow:icon-pick",
29105
29565
  key: editable.dataset.ohwKey ?? "",
@@ -29327,6 +29787,9 @@ function OhhwellsBridge() {
29327
29787
  setHoveredItemRect(null);
29328
29788
  hoveredNavContainerRef.current = null;
29329
29789
  setHoveredNavContainerRect(null);
29790
+ siblingHintElRef.current = null;
29791
+ setSiblingHintRect(null);
29792
+ setSiblingHintRects([]);
29330
29793
  return;
29331
29794
  }
29332
29795
  {
@@ -29447,7 +29910,6 @@ function OhhwellsBridge() {
29447
29910
  hoveredNavContainerRef.current = null;
29448
29911
  setHoveredNavContainerRect(null);
29449
29912
  hoveredItemElRef.current = editable;
29450
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29451
29913
  }
29452
29914
  }
29453
29915
  }
@@ -30157,7 +30619,11 @@ function OhhwellsBridge() {
30157
30619
  };
30158
30620
  const handleMouseMove = (e) => {
30159
30621
  const { clientX, clientY } = e;
30160
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30622
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30623
+ dismissImageHover();
30624
+ clearImageHover();
30625
+ return;
30626
+ }
30161
30627
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30162
30628
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30163
30629
  formHoverElRef.current = null;
@@ -30186,7 +30652,12 @@ function OhhwellsBridge() {
30186
30652
  setHoveredItemRect(null);
30187
30653
  hoveredNavContainerRef.current = null;
30188
30654
  setHoveredNavContainerRect(null);
30655
+ siblingHintElRef.current = null;
30656
+ setSiblingHintRect(null);
30657
+ setSiblingHintRects([]);
30189
30658
  dismissImageHover();
30659
+ clearImageHover();
30660
+ setSectionGap(null);
30190
30661
  return;
30191
30662
  }
30192
30663
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30198,7 +30669,11 @@ function OhhwellsBridge() {
30198
30669
  if (e.data?.type !== "ow:pointer-sync") return;
30199
30670
  const { clientX, clientY } = e.data;
30200
30671
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30201
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30672
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30673
+ dismissImageHover();
30674
+ clearImageHover();
30675
+ return;
30676
+ }
30202
30677
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30203
30678
  if (probeSocialsRowAt(clientX, clientY)) return;
30204
30679
  probeSectionGapAt(clientX, clientY);
@@ -30578,6 +31053,7 @@ function OhhwellsBridge() {
30578
31053
  applyAiFooterFromContent(content);
30579
31054
  if (typeof content[STYLE_STORE_KEY] === "string") {
30580
31055
  stylesRef.current = content[STYLE_STORE_KEY];
31056
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
30581
31057
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
30582
31058
  }
30583
31059
  applyBrandChrome(content);
@@ -30592,15 +31068,16 @@ function OhhwellsBridge() {
30592
31068
  }
30593
31069
  if (key === AI_SECTIONS_KEY) continue;
30594
31070
  if (key === AI_FOOTER_KEY) continue;
31071
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31072
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
30595
31073
  if (key === BRAND_KIT_KEY) continue;
30596
31074
  if (key === STYLE_STORE_KEY) continue;
30597
31075
  if (BRAND_CHROME_KEYS.has(key)) continue;
30598
- if (key === LOGO_PLACEHOLDER_KEY) continue;
30599
31076
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30600
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
30601
31077
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
30602
31078
  continue;
30603
31079
  }
31080
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
30604
31081
  if (applyVideoSettingNode(key, val)) continue;
30605
31082
  if (applyCarouselNode(key, val)) continue;
30606
31083
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -30626,6 +31103,7 @@ function OhhwellsBridge() {
30626
31103
  });
30627
31104
  applyLinkByKey(key, val);
30628
31105
  }
31106
+ applySectionEmbeds(content);
30629
31107
  applyLogoFromContent(content);
30630
31108
  applyLogoSizes(content);
30631
31109
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31233,6 +31711,12 @@ function OhhwellsBridge() {
31233
31711
  closeLinkPopoverRef.current();
31234
31712
  return;
31235
31713
  }
31714
+ if (floatingPanelOpenRef.current) {
31715
+ setFloatingPanelRef.current(null);
31716
+ deselectRef.current();
31717
+ deactivateRef.current();
31718
+ return;
31719
+ }
31236
31720
  deselectRef.current();
31237
31721
  deactivateRef.current();
31238
31722
  clearMediaSelectionRef.current();
@@ -32068,17 +32552,17 @@ function OhhwellsBridge() {
32068
32552
  window.removeEventListener("message", handleDuplicateSection);
32069
32553
  window.removeEventListener("message", handleDeactivate);
32070
32554
  window.removeEventListener("message", handleSelectNav);
32071
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32072
32555
  window.removeEventListener("message", handleToastAction);
32073
32556
  window.removeEventListener("message", handleFormCount);
32074
32557
  window.removeEventListener("message", handleUiEscape);
32558
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32075
32559
  autoSaveTimers.current.forEach(clearTimeout);
32076
32560
  autoSaveTimers.current.clear();
32077
32561
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
32078
32562
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
32079
32563
  };
32080
32564
  }, [isEditMode, refreshStateRules]);
32081
- (0, import_react23.useEffect)(() => {
32565
+ (0, import_react24.useEffect)(() => {
32082
32566
  if (!isEditMode) return;
32083
32567
  const THRESHOLD = 10;
32084
32568
  const resolveWasSelected = (el) => {
@@ -32234,7 +32718,7 @@ function OhhwellsBridge() {
32234
32718
  unlockFooterDragInteraction();
32235
32719
  };
32236
32720
  }, [isEditMode]);
32237
- (0, import_react23.useEffect)(() => {
32721
+ (0, import_react24.useEffect)(() => {
32238
32722
  if (!isEditMode) return;
32239
32723
  const THRESHOLD = 10;
32240
32724
  const onPointerDown = (e) => {
@@ -32325,7 +32809,7 @@ function OhhwellsBridge() {
32325
32809
  document.removeEventListener("selectstart", blockSelectStart, true);
32326
32810
  };
32327
32811
  }, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
32328
- (0, import_react23.useEffect)(() => {
32812
+ (0, import_react24.useEffect)(() => {
32329
32813
  const handler = (e) => {
32330
32814
  if (e.data?.type !== "ow:request-schedule-config") return;
32331
32815
  const insertAfterVal = e.data.insertAfter;
@@ -32341,7 +32825,7 @@ function OhhwellsBridge() {
32341
32825
  window.addEventListener("message", handler);
32342
32826
  return () => window.removeEventListener("message", handler);
32343
32827
  }, [processConfigRequest]);
32344
- (0, import_react23.useEffect)(() => {
32828
+ (0, import_react24.useEffect)(() => {
32345
32829
  if (!isEditMode) return;
32346
32830
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
32347
32831
  el.removeAttribute("data-ohw-active-state");
@@ -32365,7 +32849,7 @@ function OhhwellsBridge() {
32365
32849
  postToParent2({
32366
32850
  type: "ow:ready",
32367
32851
  version: "1",
32368
- bridgeVersion: "0.1.161",
32852
+ bridgeVersion: "0.1.163-next.434",
32369
32853
  path: pathname,
32370
32854
  nodes: collectEditableNodes(editContentRef.current),
32371
32855
  sections
@@ -32377,13 +32861,13 @@ function OhhwellsBridge() {
32377
32861
  clearTimeout(timer);
32378
32862
  };
32379
32863
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
32380
- (0, import_react23.useEffect)(() => {
32864
+ (0, import_react24.useEffect)(() => {
32381
32865
  scrollToHashSectionWhenReady();
32382
32866
  const onHashChange = () => scrollToHashSectionWhenReady();
32383
32867
  window.addEventListener("hashchange", onHashChange);
32384
32868
  return () => window.removeEventListener("hashchange", onHashChange);
32385
32869
  }, [pathname]);
32386
- const handleCommand = (0, import_react23.useCallback)((cmd) => {
32870
+ const handleCommand = (0, import_react24.useCallback)((cmd) => {
32387
32871
  const el = activeElRef.current;
32388
32872
  const selBefore = window.getSelection();
32389
32873
  let savedOffsets = null;
@@ -32419,7 +32903,7 @@ function OhhwellsBridge() {
32419
32903
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
32420
32904
  refreshActiveCommandsRef.current();
32421
32905
  }, []);
32422
- (0, import_react23.useEffect)(() => {
32906
+ (0, import_react24.useEffect)(() => {
32423
32907
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
32424
32908
  if (!session || !logoSizeDraft) return;
32425
32909
  const onPanelAction = (e) => {
@@ -32457,7 +32941,7 @@ function OhhwellsBridge() {
32457
32941
  window.addEventListener("message", onPanelAction);
32458
32942
  return () => window.removeEventListener("message", onPanelAction);
32459
32943
  }, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
32460
- const handleStateChange = (0, import_react23.useCallback)((state) => {
32944
+ const handleStateChange = (0, import_react24.useCallback)((state) => {
32461
32945
  if (!activeStateElRef.current) return;
32462
32946
  const el = activeStateElRef.current;
32463
32947
  if (state === "Default") {
@@ -32470,7 +32954,7 @@ function OhhwellsBridge() {
32470
32954
  }
32471
32955
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
32472
32956
  }, [deactivate]);
32473
- const reselectAfterLinkPopover = (0, import_react23.useCallback)(
32957
+ const reselectAfterLinkPopover = (0, import_react24.useCallback)(
32474
32958
  (hrefKey) => {
32475
32959
  requestAnimationFrame(() => {
32476
32960
  const el = resolveHrefKeyElement(hrefKey);
@@ -32479,7 +32963,7 @@ function OhhwellsBridge() {
32479
32963
  },
32480
32964
  [resolveHrefKeyElement]
32481
32965
  );
32482
- const closeLinkPopover = (0, import_react23.useCallback)(() => {
32966
+ const closeLinkPopover = (0, import_react24.useCallback)(() => {
32483
32967
  const session = linkPopoverSessionRef.current;
32484
32968
  addNavAfterAnchorRef.current = null;
32485
32969
  setLinkPopover(null);
@@ -32487,9 +32971,9 @@ function OhhwellsBridge() {
32487
32971
  reselectAfterLinkPopover(session.key);
32488
32972
  }
32489
32973
  }, [reselectAfterLinkPopover]);
32490
- const closeLinkPopoverRef = (0, import_react23.useRef)(closeLinkPopover);
32974
+ const closeLinkPopoverRef = (0, import_react24.useRef)(closeLinkPopover);
32491
32975
  closeLinkPopoverRef.current = closeLinkPopover;
32492
- const openLinkPopoverForActive = (0, import_react23.useCallback)(() => {
32976
+ const openLinkPopoverForActive = (0, import_react24.useCallback)(() => {
32493
32977
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
32494
32978
  if (!hrefCtx) return;
32495
32979
  bumpLinkPopoverGrace();
@@ -32500,7 +32984,7 @@ function OhhwellsBridge() {
32500
32984
  });
32501
32985
  deactivate();
32502
32986
  }, [deactivate]);
32503
- const openLinkPopoverForSelected = (0, import_react23.useCallback)(() => {
32987
+ const openLinkPopoverForSelected = (0, import_react24.useCallback)(() => {
32504
32988
  const anchor = selectedElRef.current;
32505
32989
  if (!anchor) return;
32506
32990
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -32517,7 +33001,7 @@ function OhhwellsBridge() {
32517
33001
  });
32518
33002
  deselect();
32519
33003
  }, [deselect]);
32520
- const handleSelectParent = (0, import_react23.useCallback)(() => {
33004
+ const handleSelectParent = (0, import_react24.useCallback)(() => {
32521
33005
  const selected = selectedElRef.current;
32522
33006
  if (!selected) return;
32523
33007
  if (toolbarVariantRef.current === "select-frame") {
@@ -32544,7 +33028,7 @@ function OhhwellsBridge() {
32544
33028
  }
32545
33029
  deselectRef.current();
32546
33030
  }, []);
32547
- const handleDuplicateSelected = (0, import_react23.useCallback)(() => {
33031
+ const handleDuplicateSelected = (0, import_react24.useCallback)(() => {
32548
33032
  const selected = selectedElRef.current;
32549
33033
  if (!selected || !isNavigationItem2(selected)) return;
32550
33034
  if (isCtaButton(selected)) {
@@ -32713,7 +33197,7 @@ function OhhwellsBridge() {
32713
33197
  });
32714
33198
  }
32715
33199
  }, [postToParent2, tokensForButton]);
32716
- const runPendingDeleteUndo = (0, import_react23.useCallback)(() => {
33200
+ const runPendingDeleteUndo = (0, import_react24.useCallback)(() => {
32717
33201
  const pending = pendingDeleteUndoRef.current;
32718
33202
  if (!pending) return false;
32719
33203
  pendingDeleteUndoRef.current = null;
@@ -32721,7 +33205,7 @@ function OhhwellsBridge() {
32721
33205
  enforceLinkHrefs();
32722
33206
  return true;
32723
33207
  }, []);
32724
- const handleDeleteSelected = (0, import_react23.useCallback)(() => {
33208
+ const handleDeleteSelected = (0, import_react24.useCallback)(() => {
32725
33209
  const selected = selectedElRef.current;
32726
33210
  if (!selected) return false;
32727
33211
  if (isCtaButton(selected)) {
@@ -32783,7 +33267,7 @@ function OhhwellsBridge() {
32783
33267
  }, [postToParent2]);
32784
33268
  handleDeleteSelectedRef.current = handleDeleteSelected;
32785
33269
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
32786
- const handleLinkPopoverSubmit = (0, import_react23.useCallback)(
33270
+ const handleLinkPopoverSubmit = (0, import_react24.useCallback)(
32787
33271
  (target) => {
32788
33272
  const session = linkPopoverSessionRef.current;
32789
33273
  if (!session) return;
@@ -32849,14 +33333,14 @@ function OhhwellsBridge() {
32849
33333
  const showEditLink = toolbarShowEditLink;
32850
33334
  const currentSections = sectionsByPath[pathname] ?? [];
32851
33335
  linkPopoverOpenRef.current = linkPopover !== null;
32852
- const handleMediaSelect = (0, import_react23.useCallback)((key) => {
33336
+ const handleMediaSelect = (0, import_react24.useCallback)((key) => {
32853
33337
  const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
32854
33338
  (m) => (m.dataset.ohwKey ?? "") === key
32855
33339
  ) ?? null;
32856
33340
  if (!el) return;
32857
33341
  selectMediaElementRef.current(el);
32858
33342
  }, []);
32859
- const handleMediaReplace = (0, import_react23.useCallback)(
33343
+ const handleMediaReplace = (0, import_react24.useCallback)(
32860
33344
  (key) => {
32861
33345
  postToParent2({
32862
33346
  type: "ow:image-pick",
@@ -32866,13 +33350,13 @@ function OhhwellsBridge() {
32866
33350
  },
32867
33351
  [postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
32868
33352
  );
32869
- const handleEditCarousel = (0, import_react23.useCallback)(
33353
+ const handleEditCarousel = (0, import_react24.useCallback)(
32870
33354
  (key) => {
32871
33355
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
32872
33356
  },
32873
33357
  [postToParent2]
32874
33358
  );
32875
- const handleMediaFadeOutComplete = (0, import_react23.useCallback)((key) => {
33359
+ const handleMediaFadeOutComplete = (0, import_react24.useCallback)((key) => {
32876
33360
  setUploadingRects((prev) => {
32877
33361
  if (!(key in prev)) return prev;
32878
33362
  const next = { ...prev };
@@ -32880,7 +33364,7 @@ function OhhwellsBridge() {
32880
33364
  return next;
32881
33365
  });
32882
33366
  }, []);
32883
- const handleVideoSettingsChange = (0, import_react23.useCallback)(
33367
+ const handleVideoSettingsChange = (0, import_react24.useCallback)(
32884
33368
  (key, settings) => {
32885
33369
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
32886
33370
  const video = getVideoEl2(el);
@@ -33594,6 +34078,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
33594
34078
  hasMountedContentNodes,
33595
34079
  indexCollectionItems,
33596
34080
  insertFooterHours,
34081
+ isDeadPageHref,
33597
34082
  isEditSessionActive,
33598
34083
  isPlainLeftClick,
33599
34084
  isRenderableFooterTree,
@@ -33605,6 +34090,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
33605
34090
  parseAiFooterState,
33606
34091
  parseAiSectionsState,
33607
34092
  parseTarget,
34093
+ planBuildPageSync,
33608
34094
  recordOverriddenPaths,
33609
34095
  releaseTemplateLogoIfReplaced,
33610
34096
  removeFooterBlock,