@ohhwells/bridge 0.1.163 → 0.1.164-next.439

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/OhhwellsBridge.tsx
4
- import React12, { useCallback as useCallback12, useEffect as useEffect19, useLayoutEffect as useLayoutEffect6, useRef as useRef14, useState as useState18 } from "react";
4
+ import React12, { useCallback as useCallback12, useEffect as useEffect20, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
5
5
  import { createRoot as createRoot3 } from "react-dom/client";
6
6
  import { flushSync as flushSync3 } from "react-dom";
7
7
 
@@ -840,6 +840,10 @@ function useOhwCarousel(key, initial) {
840
840
  if (Array.isArray(detail?.images)) setImages(detail.images);
841
841
  };
842
842
  el.addEventListener(CAROUSEL_EVENT, onChange);
843
+ const pending = parseSlides(el.getAttribute(CAROUSEL_VALUE_ATTR));
844
+ if (pending.length > 0) {
845
+ setImages((prev) => JSON.stringify(prev) === JSON.stringify(pending) ? prev : pending);
846
+ }
843
847
  return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
844
848
  }, [key]);
845
849
  const bind = {
@@ -1094,21 +1098,21 @@ function chromeFrom(sample) {
1094
1098
  };
1095
1099
  }
1096
1100
  function filledPrimary(seed) {
1097
- const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1098
- const luminance = relativeLuminance(paint);
1101
+ const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1102
+ const luminance = relativeLuminance(paint2);
1099
1103
  return {
1100
- background: toCss({ ...paint, a: 1 }),
1104
+ background: toCss({ ...paint2, a: 1 }),
1101
1105
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1102
1106
  borderColor: TRANSPARENT,
1103
1107
  borderWidth: "0px"
1104
1108
  };
1105
1109
  }
1106
1110
  function generatedSecondary(primary) {
1107
- const paint = accentColor(primary);
1111
+ const paint2 = accentColor(primary);
1108
1112
  return {
1109
1113
  background: TRANSPARENT,
1110
- color: paint,
1111
- borderColor: paint,
1114
+ color: paint2,
1115
+ borderColor: paint2,
1112
1116
  borderWidth: "1px"
1113
1117
  };
1114
1118
  }
@@ -1121,9 +1125,9 @@ function generatedGhost(primary) {
1121
1125
  };
1122
1126
  }
1123
1127
  function normalizeOutlineChrome(outline, primary) {
1124
- const paint = accentColor(primary);
1128
+ const paint2 = accentColor(primary);
1125
1129
  const text = parseColor(outline.color);
1126
- const paintRgb = parseColor(paint);
1130
+ const paintRgb = parseColor(paint2);
1127
1131
  const primaryLabel = parseColor(primary.color);
1128
1132
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1129
1133
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1132,8 +1136,8 @@ function normalizeOutlineChrome(outline, primary) {
1132
1136
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1133
1137
  return {
1134
1138
  ...outline,
1135
- color: paint,
1136
- borderColor: hasBorder ? paint : outline.borderColor
1139
+ color: paint2,
1140
+ borderColor: hasBorder ? paint2 : outline.borderColor
1137
1141
  };
1138
1142
  }
1139
1143
  function generateButtonVariants(samples) {
@@ -2524,6 +2528,14 @@ function socialHrefKey(item) {
2524
2528
  function socialIconKey(item) {
2525
2529
  return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
2526
2530
  }
2531
+ function pendingIconKey(item) {
2532
+ const existing = socialIconKey(item);
2533
+ if (existing) return existing;
2534
+ const base = socialHrefKey(item)?.replace(/-href$/, "");
2535
+ if (!base) return null;
2536
+ const taken = item.ownerDocument.querySelector(`[data-ohw-key="${base}"]`);
2537
+ return taken && taken !== item ? `${base}-icon` : base;
2538
+ }
2527
2539
  var SOCIAL_PLATFORM_LABELS = {
2528
2540
  instagram: "Instagram",
2529
2541
  facebook: "Facebook",
@@ -2721,9 +2733,9 @@ function reconcileSocialsFromContent(content, root = document) {
2721
2733
  listSocialsRows(root).forEach((row) => {
2722
2734
  const rowDisplay = socialsDisplayFor(row, content);
2723
2735
  listSocialItems(row).forEach((item) => {
2724
- const key = socialIconKey(item) ?? socialHrefKey(item)?.replace(/-href$/, "");
2736
+ const key = pendingIconKey(item);
2725
2737
  const stored2 = key ? content[key] : void 0;
2726
- if (!stored2?.trim()) return;
2738
+ if (!stored2?.trim().startsWith("<")) return;
2727
2739
  const existing = item.querySelector(ICON_SELECTOR);
2728
2740
  if (existing && existing.innerHTML.trim() && !existing.hasAttribute(SOCIALS_ICON_PLACEHOLDER_ATTR)) return;
2729
2741
  ensureIconSlot(item);
@@ -2983,8 +2995,7 @@ function ensureIconSlot(item) {
2983
2995
  const adopted = adoptAsIconSlot(drawn, base);
2984
2996
  if (adopted) return adopted;
2985
2997
  }
2986
- const taken = document.querySelector(`[data-ohw-key="${base}"]`);
2987
- const iconKey = taken && taken !== item ? `${base}-icon` : base;
2998
+ const iconKey = pendingIconKey(item) ?? base;
2988
2999
  const slot = document.createElement("span");
2989
3000
  slot.setAttribute("data-ohw-key", iconKey);
2990
3001
  slot.setAttribute("data-ohw-editable", "icon");
@@ -3496,11 +3507,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
3496
3507
  container.appendChild(column);
3497
3508
  return { column, firstLink };
3498
3509
  }
3499
- function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
3510
+ function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
3500
3511
  if (!canAddFooterColumn()) {
3501
3512
  throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
3502
3513
  }
3503
- const resolvedHref = linkHref || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
3514
+ const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
3504
3515
  const colIndex = getNextFooterColumnIndex();
3505
3516
  const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
3506
3517
  if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
@@ -3879,8 +3890,8 @@ function duplicateFooterItem(sourceAnchor) {
3879
3890
  const column = findFooterColumnForLink(sourceAnchor);
3880
3891
  if (!column) return null;
3881
3892
  const href = getLinkHref(sourceAnchor);
3882
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
3883
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
3893
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
3894
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
3884
3895
  return insertFooterItem(column, href || "/", label, sourceAnchor);
3885
3896
  }
3886
3897
  function footerLabelKeyFromHrefKey(hrefKey) {
@@ -3890,8 +3901,8 @@ function deleteFooterItem(sourceAnchor) {
3890
3901
  if (!isFooterLinkAnchor(sourceAnchor)) return null;
3891
3902
  const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
3892
3903
  if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
3893
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
3894
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
3904
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
3905
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
3895
3906
  const labelKey = footerLabelKeyFromHrefKey(hrefKey);
3896
3907
  const previousOrder = getFooterOrderFromDom();
3897
3908
  const previousOrderJson = JSON.stringify(previousOrder);
@@ -4859,8 +4870,8 @@ function remapNavKeysInSubtree(root, keyMap) {
4859
4870
  const mapped = keyMap.get(oldHrefKey);
4860
4871
  if (!mapped) return;
4861
4872
  el.setAttribute("data-ohw-href-key", mapped.hrefKey);
4862
- const labelEl = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
4863
- if (labelEl) labelEl.setAttribute("data-ohw-key", mapped.labelKey);
4873
+ const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
4874
+ if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
4864
4875
  };
4865
4876
  if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
4866
4877
  root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
@@ -4868,10 +4879,10 @@ function remapNavKeysInSubtree(root, keyMap) {
4868
4879
  function readNavLinkSnapshot(hrefKey) {
4869
4880
  const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
4870
4881
  if (!el) return { href: "/", label: "Untitled" };
4871
- const labelEl = el.querySelector('[data-ohw-editable="text"]');
4882
+ const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
4872
4883
  return {
4873
4884
  href: getLinkHref2(el),
4874
- label: (labelEl?.textContent ?? "").trim() || "Untitled"
4885
+ label: (labelEl2?.textContent ?? "").trim() || "Untitled"
4875
4886
  };
4876
4887
  }
4877
4888
  function findClonedNavAnchor(unit, hrefKey) {
@@ -5045,8 +5056,8 @@ function deleteNavbarItem(sourceAnchor) {
5045
5056
  if (!isNavbarLinkItem(sourceAnchor)) return null;
5046
5057
  const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
5047
5058
  if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
5048
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
5049
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
5059
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
5060
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
5050
5061
  const previousForest = getNavForestFromDom();
5051
5062
  const previousOrderJson = serializeNavOrder(previousForest);
5052
5063
  const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
@@ -6421,6 +6432,24 @@ function deleteSectionFromState(state, sectionId) {
6421
6432
  if (removed.includes(sectionId)) return state;
6422
6433
  return { ...state, v: 1, sections: state.sections, removed: [...removed, sectionId] };
6423
6434
  }
6435
+ function moveSectionInState(state, sectionId, targetPath) {
6436
+ const entry = state.sections.find((section) => section.id === sectionId);
6437
+ if (!entry) return null;
6438
+ const moved = {
6439
+ id: entry.id,
6440
+ label: entry.label,
6441
+ path: targetPath,
6442
+ afterSection: null,
6443
+ tree: entry.tree,
6444
+ media: entry.media,
6445
+ ...entry.brand ? { brand: entry.brand } : {}
6446
+ };
6447
+ return {
6448
+ ...state,
6449
+ v: 1,
6450
+ sections: state.sections.map((section) => section.id === sectionId ? moved : section)
6451
+ };
6452
+ }
6424
6453
  function reapRemovedAiSections(state, store, removedIds, excludeIds = /* @__PURE__ */ new Set()) {
6425
6454
  const generated = new Set(state.sections.map((entry) => entry.id));
6426
6455
  const reapedIds = [...new Set(removedIds)].filter((id) => generated.has(id) && !excludeIds.has(id));
@@ -6649,6 +6678,21 @@ function pricingCardFeatureCount(tree, index) {
6649
6678
  const target = findPricingCollection(tree)?.children?.[index];
6650
6679
  return target ? pricingFeatureList(target).length : 0;
6651
6680
  }
6681
+ function prevailingFeatureIcon(features) {
6682
+ const counts = /* @__PURE__ */ new Map();
6683
+ for (const row of features) {
6684
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6685
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6686
+ entry.count += 1;
6687
+ counts.set(key, entry);
6688
+ }
6689
+ let best = null;
6690
+ for (const entry of counts.values()) {
6691
+ if (!best || entry.count > best.count) best = entry;
6692
+ }
6693
+ if (!best) return {};
6694
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6695
+ }
6652
6696
  function addPricingCardFeature(tree, index, text) {
6653
6697
  return withPricingCollection(tree, (collection) => {
6654
6698
  const children = collection.children;
@@ -6657,7 +6701,7 @@ function addPricingCardFeature(tree, index, text) {
6657
6701
  const features = pricingFeatureList(target);
6658
6702
  if (features.length >= PRICING_FEATURES_MAX) return false;
6659
6703
  target.slots = target.slots ?? {};
6660
- target.slots.features = [...features, { text }];
6704
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6661
6705
  return true;
6662
6706
  });
6663
6707
  }
@@ -7301,6 +7345,120 @@ function findSelectableNavContainer(doc = document) {
7301
7345
  );
7302
7346
  }
7303
7347
 
7348
+ // src/lib/youtube.ts
7349
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7350
+ function extractYouTubeId(input) {
7351
+ const trimmed = input.trim();
7352
+ if (!trimmed) return null;
7353
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7354
+ let url;
7355
+ try {
7356
+ url = new URL(trimmed);
7357
+ } catch {
7358
+ return null;
7359
+ }
7360
+ const host = url.hostname.replace(/^www\./, "");
7361
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7362
+ return null;
7363
+ }
7364
+ let candidate = null;
7365
+ if (host === "youtu.be") {
7366
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7367
+ } else if (url.pathname === "/watch") {
7368
+ candidate = url.searchParams.get("v");
7369
+ } else {
7370
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7371
+ candidate = match ? match[1] : null;
7372
+ }
7373
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7374
+ }
7375
+
7376
+ // src/lib/section-embed.ts
7377
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7378
+ function readStoredEmbed(value) {
7379
+ if (value.startsWith("start\n")) {
7380
+ return { raw: value.slice("start\n".length), at: "start" };
7381
+ }
7382
+ return { raw: value, at: "end" };
7383
+ }
7384
+ function embedFrameSrc(value) {
7385
+ const videoId = extractYouTubeId(value);
7386
+ if (videoId) {
7387
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7388
+ }
7389
+ let url;
7390
+ try {
7391
+ url = new URL(value);
7392
+ } catch {
7393
+ return null;
7394
+ }
7395
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7396
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7397
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7398
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7399
+ return { src, title: "Map" };
7400
+ }
7401
+ if (host === "maps.app.goo.gl") {
7402
+ return { src: value, title: "Map" };
7403
+ }
7404
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7405
+ return { src: value, title: "Calendar" };
7406
+ }
7407
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7408
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7409
+ }
7410
+ if (host === "forms.gle") {
7411
+ return { src: value, title: "Form" };
7412
+ }
7413
+ return null;
7414
+ }
7415
+ function place(section, box, at) {
7416
+ if (at === "start") {
7417
+ section.insertBefore(box, section.firstChild);
7418
+ return;
7419
+ }
7420
+ section.appendChild(box);
7421
+ }
7422
+ function paint(section, key, src, title, at) {
7423
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7424
+ const frame = existing?.querySelector("iframe");
7425
+ if (existing && frame) {
7426
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7427
+ frame.title = title;
7428
+ place(section, existing, at);
7429
+ return;
7430
+ }
7431
+ existing?.remove();
7432
+ const box = document.createElement("div");
7433
+ box.setAttribute("data-ohw-section-embed", key);
7434
+ 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;";
7435
+ const frameWrap = document.createElement("div");
7436
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7437
+ const iframe = document.createElement("iframe");
7438
+ iframe.src = src;
7439
+ iframe.title = title;
7440
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7441
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7442
+ iframe.setAttribute("allowfullscreen", "");
7443
+ frameWrap.appendChild(iframe);
7444
+ box.appendChild(frameWrap);
7445
+ place(section, box, at);
7446
+ }
7447
+ function applySectionEmbeds(content) {
7448
+ for (const [key, val] of Object.entries(content)) {
7449
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7450
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7451
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7452
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7453
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7454
+ if (!section || !stored || !frame) {
7455
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7456
+ continue;
7457
+ }
7458
+ paint(section, key, frame.src, frame.title, stored.at);
7459
+ }
7460
+ }
7461
+
7304
7462
  // src/ui/ai-tree/aiSectionsManager.tsx
7305
7463
  import { flushSync } from "react-dom";
7306
7464
  import { createRoot } from "react-dom/client";
@@ -7874,7 +8032,7 @@ var AI_MOBILE_CSS = [
7874
8032
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
7875
8033
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
7876
8034
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
7877
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8035
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
7878
8036
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
7879
8037
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
7880
8038
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -7890,8 +8048,10 @@ var AI_MOBILE_CSS = [
7890
8048
  "[data-ai-section]{overflow-x:hidden}",
7891
8049
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
7892
8050
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
7893
- // still got a 20px band of section background down both sides on a phone.
7894
- "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8051
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8052
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8053
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8054
+ "[data-ai-container]{padding:0 20px !important}",
7895
8055
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
7896
8056
  "[data-ai-cell]{width:100%;min-width:0}",
7897
8057
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8096,6 +8256,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8096
8256
  function textAttrs(ctx, path) {
8097
8257
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8098
8258
  }
8259
+ var AI_RESPONSIVE_CSS = [
8260
+ "@media (max-width: 960px) {",
8261
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8262
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8263
+ "}",
8264
+ "@media (max-width: 640px) {",
8265
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8266
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8267
+ // Group containers flatten to a column on phones; span placements come along for free.
8268
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8269
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8270
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8271
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8272
+ // layered text used to be.
8273
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8274
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8275
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8276
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8277
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8278
+ // other rule had already been taught to stand down.
8279
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8280
+ " [data-ai-responsive] { overflow-x: hidden; }",
8281
+ " [data-ai-responsive] img { max-width: 100%; }",
8282
+ "}"
8283
+ ].join("\n");
8099
8284
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8100
8285
  function MediaBox({
8101
8286
  refValue,
@@ -8150,7 +8335,7 @@ function MediaBox({
8150
8335
  position: fill ? "absolute" : void 0,
8151
8336
  inset: fill ? 0 : void 0,
8152
8337
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8153
- height: fill ? "100%" : void 0,
8338
+ height: fill ? "100%" : fixedSize ? height : void 0,
8154
8339
  aspectRatio: fill ? void 0 : aspectRatio,
8155
8340
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8156
8341
  borderRadius: radius,
@@ -9646,7 +9831,7 @@ function CollectionBlock({ node, ctx, path }) {
9646
9831
  return /* @__PURE__ */ jsx(
9647
9832
  "div",
9648
9833
  {
9649
- "data-ai-grid": "",
9834
+ "data-ai-grid": String(itemsPerRow),
9650
9835
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9651
9836
  style: {
9652
9837
  display: "grid",
@@ -9948,7 +10133,7 @@ function renderNode(node, ctx, path, ambientAlign) {
9948
10133
  },
9949
10134
  children: [
9950
10135
  i > 0 && ctx.heroOverlapFullBleed ? (
9951
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10136
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
9952
10137
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
9953
10138
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
9954
10139
  // the full section width instead of reading at the usual content width.
@@ -10367,6 +10552,7 @@ function AiTreeRenderer({
10367
10552
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10368
10553
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10369
10554
  ...bgAttrs,
10555
+ "data-ai-responsive": "",
10370
10556
  style: {
10371
10557
  position: "relative",
10372
10558
  padding: `${padCss} 0`,
@@ -10380,12 +10566,13 @@ function AiTreeRenderer({
10380
10566
  ...fillHeight ? { display: "grid" } : {}
10381
10567
  },
10382
10568
  children: [
10383
- isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10569
+ /* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
10384
10570
  /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10571
+ isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10385
10572
  /* @__PURE__ */ jsx(
10386
10573
  "div",
10387
10574
  {
10388
- "data-ai-container": "",
10575
+ "data-ai-section-inner": "",
10389
10576
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10390
10577
  style: {
10391
10578
  position: "relative",
@@ -10402,7 +10589,7 @@ function AiTreeRenderer({
10402
10589
  children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
10403
10590
  "div",
10404
10591
  {
10405
- "data-ai-row": "",
10592
+ "data-ai-columns": "",
10406
10593
  style: {
10407
10594
  display: "grid",
10408
10595
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11064,9 +11251,10 @@ function applyAiSectionsToDom(state, options) {
11064
11251
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11065
11252
  continue;
11066
11253
  }
11067
- const isNewMount = !existing || !existing.container.isConnected;
11068
11254
  let container = existing?.container;
11255
+ let isNewMount = false;
11069
11256
  if (!container || !container.isConnected) {
11257
+ isNewMount = true;
11070
11258
  existing?.root.unmount();
11071
11259
  container?.remove();
11072
11260
  container = document.createElement("div");
@@ -11404,6 +11592,34 @@ function minSpanForFooterBlock(type) {
11404
11592
  return 3;
11405
11593
  }
11406
11594
  }
11595
+ function readLiveSocialItems() {
11596
+ const root = getFooterRoot();
11597
+ const row = root?.querySelector("[data-ohw-socials-row]");
11598
+ if (!row) return [];
11599
+ const items = [];
11600
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11601
+ const href = anchor.getAttribute("href")?.trim() ?? "";
11602
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11603
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11604
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
11605
+ items.push({ platform, href });
11606
+ }
11607
+ return items;
11608
+ }
11609
+ function syncSocialRowsFromDom(tree) {
11610
+ const root = getFooterRoot();
11611
+ if (!root) return;
11612
+ const row = root.querySelector("[data-ohw-socials-row]");
11613
+ const live = readLiveSocialItems();
11614
+ if (row && live.length === 0) return;
11615
+ for (const col of tree.columns) {
11616
+ col.blocks = col.blocks.flatMap((block) => {
11617
+ if (block.type !== "social-row") return [block];
11618
+ if (!row) return [];
11619
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11620
+ });
11621
+ }
11622
+ }
11407
11623
  function collectBrandBlocks(tree) {
11408
11624
  const brand = [];
11409
11625
  for (const col of tree.columns) {
@@ -11649,12 +11865,13 @@ function textOf2(el) {
11649
11865
  }
11650
11866
  function syncFooterTreeLinksFromDom(tree) {
11651
11867
  const next = cloneTree(tree);
11868
+ syncSocialRowsFromDom(next);
11652
11869
  const domCols = listFooterColumns().map((col) => {
11653
11870
  const heading = getFooterColumnHeadingEl(col);
11654
11871
  const title = heading ? textOf2(heading) : void 0;
11655
11872
  const items = listFooterLinksInColumn(col).map((anchor) => {
11656
- const labelEl = anchor.querySelector('[data-ohw-editable="text"]');
11657
- const label = textOf2(labelEl) || textOf2(anchor);
11873
+ const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
11874
+ const label = textOf2(labelEl2) || textOf2(anchor);
11658
11875
  const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
11659
11876
  return label ? { label, href: href || "home" } : null;
11660
11877
  }).filter((x) => Boolean(x));
@@ -17353,7 +17570,7 @@ function apiBase() {
17353
17570
  function bridgeVersion() {
17354
17571
  try {
17355
17572
  if (true) {
17356
- return "0.1.163";
17573
+ return "0.1.164-next.439";
17357
17574
  }
17358
17575
  } catch {
17359
17576
  }
@@ -17367,7 +17584,7 @@ function stampBridgeVersionOnDocument() {
17367
17584
  return;
17368
17585
  }
17369
17586
  try {
17370
- const v = true ? "0.1.163" : "";
17587
+ const v = true ? "0.1.164-next.439" : "";
17371
17588
  if (v) {
17372
17589
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17373
17590
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18045,6 +18262,7 @@ function MediaOverlay({
18045
18262
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18046
18263
  );
18047
18264
  }, [isVideo]);
18265
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18048
18266
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18049
18267
  const box = {
18050
18268
  position: "fixed",
@@ -18143,11 +18361,10 @@ function MediaOverlay({
18143
18361
  className: "flex items-center justify-center cursor-pointer",
18144
18362
  style: {
18145
18363
  ...box,
18146
- // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18147
- // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18148
- // in-document, pointer-events does it natively. The button below opts back in, so
18149
- // Replace still works.
18150
- pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18364
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18365
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18366
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18367
+ pointerEvents: "none",
18151
18368
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18152
18369
  // than hovered. Hover keeps the existing tinted preview.
18153
18370
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18174,17 +18391,17 @@ function MediaOverlay({
18174
18391
  },
18175
18392
  children: [
18176
18393
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18177
- isVideo ? "Replace video" : "Replace image"
18394
+ replaceLabel
18178
18395
  ]
18179
18396
  }
18180
18397
  ),
18181
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ jsxs8(
18398
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
18182
18399
  Button,
18183
18400
  {
18184
18401
  "data-ohw-media-overlay": "",
18185
18402
  variant: "outline",
18186
18403
  size: "sm",
18187
- "aria-label": isVideo ? "Replace video" : "Replace image",
18404
+ "aria-label": replaceLabel,
18188
18405
  className: "gap-1.5 cursor-pointer hover:bg-background",
18189
18406
  style: {
18190
18407
  ...OVERLAY_BUTTON_STYLE,
@@ -18207,7 +18424,7 @@ function MediaOverlay({
18207
18424
  },
18208
18425
  children: [
18209
18426
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18210
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18427
+ replaceMode === "full" ? replaceLabel : null
18211
18428
  ]
18212
18429
  }
18213
18430
  )
@@ -18800,8 +19017,24 @@ function AiSectionOverlay({
18800
19017
  }
18801
19018
 
18802
19019
  // src/ui/ai-section/AiMediaStripOverlay.tsx
18803
- import { useCallback as useCallback3, useEffect as useEffect8, useRef as useRef5, useState as useState8 } from "react";
18804
- import { Star } from "lucide-react";
19020
+ import { useCallback as useCallback3, useEffect as useEffect8, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
19021
+ import {
19022
+ AlignCenter,
19023
+ AlignLeft,
19024
+ AlignRight,
19025
+ ArrowLeft as ArrowLeft2,
19026
+ ArrowRight as ArrowRight2,
19027
+ Check as Check2,
19028
+ ChevronDown as ChevronDown3,
19029
+ Image as ImageIcon2,
19030
+ ImageMinus,
19031
+ ImagePlus,
19032
+ Link as LinkIcon,
19033
+ Minus,
19034
+ Palette,
19035
+ Plus as Plus2,
19036
+ Star
19037
+ } from "lucide-react";
18805
19038
 
18806
19039
  // src/lib/ai-media-strip-tree.ts
18807
19040
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -18915,14 +19148,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
18915
19148
  return true;
18916
19149
  });
18917
19150
  }
18918
- function setMediaStripItemAlt(tree, index, alt) {
18919
- return withMediaStrip(tree, (block) => {
18920
- const items = block.items;
18921
- if (index < 0 || index >= items.length) return false;
18922
- items[index] = { ...items[index], alt };
18923
- return true;
18924
- });
18925
- }
18926
19151
  function setMediaStripItemLink(tree, index, link) {
18927
19152
  return withMediaStrip(tree, (block) => {
18928
19153
  const items = block.items;
@@ -18940,11 +19165,117 @@ function setMediaStripItemLink(tree, index, link) {
18940
19165
  });
18941
19166
  }
18942
19167
 
19168
+ // src/ui/dialog.tsx
19169
+ import * as React9 from "react";
19170
+ import { Dialog as DialogPrimitive } from "radix-ui";
19171
+ import { X as X2 } from "lucide-react";
19172
+ import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19173
+ function Dialog2({
19174
+ ...props
19175
+ }) {
19176
+ return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
19177
+ }
19178
+ function DialogPortal({
19179
+ ...props
19180
+ }) {
19181
+ return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
19182
+ }
19183
+ function DialogOverlay({
19184
+ className,
19185
+ ...props
19186
+ }) {
19187
+ return /* @__PURE__ */ jsx20(
19188
+ DialogPrimitive.Overlay,
19189
+ {
19190
+ "data-slot": "dialog-overlay",
19191
+ "data-ohw-link-modal-root": "",
19192
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19193
+ ...props
19194
+ }
19195
+ );
19196
+ }
19197
+ var DialogContent = React9.forwardRef(
19198
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19199
+ const positionMode = container ? "absolute" : "fixed";
19200
+ return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
19201
+ /* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19202
+ /* @__PURE__ */ jsxs11(
19203
+ DialogPrimitive.Content,
19204
+ {
19205
+ ref,
19206
+ "data-slot": "dialog-content",
19207
+ className: cn(
19208
+ positionMode,
19209
+ "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",
19210
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19211
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19212
+ className
19213
+ ),
19214
+ onMouseDown: (e) => e.stopPropagation(),
19215
+ ...props,
19216
+ children: [
19217
+ children,
19218
+ showCloseButton ? /* @__PURE__ */ jsx20(
19219
+ DialogPrimitive.Close,
19220
+ {
19221
+ type: "button",
19222
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19223
+ "aria-label": "Close",
19224
+ children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
19225
+ }
19226
+ ) : null
19227
+ ]
19228
+ }
19229
+ )
19230
+ ] });
19231
+ }
19232
+ );
19233
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
19234
+ function DialogHeader({
19235
+ className,
19236
+ ...props
19237
+ }) {
19238
+ return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19239
+ }
19240
+ function DialogFooter({
19241
+ className,
19242
+ ...props
19243
+ }) {
19244
+ return /* @__PURE__ */ jsx20(
19245
+ "div",
19246
+ {
19247
+ className: cn("flex items-center justify-end gap-2", className),
19248
+ ...props
19249
+ }
19250
+ );
19251
+ }
19252
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19253
+ DialogPrimitive.Title,
19254
+ {
19255
+ ref,
19256
+ className: cn(
19257
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19258
+ className
19259
+ ),
19260
+ ...props
19261
+ }
19262
+ ));
19263
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
19264
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19265
+ DialogPrimitive.Description,
19266
+ {
19267
+ ref,
19268
+ className: cn("text-sm text-muted-foreground", className),
19269
+ ...props
19270
+ }
19271
+ ));
19272
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
19273
+ var DialogClose = DialogPrimitive.Close;
19274
+
18943
19275
  // src/ui/ai-section/AiMediaStripOverlay.tsx
18944
- import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
18945
- var PRIMARY3 = "#0885FE";
18946
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
18947
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19276
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19277
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19278
+ 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]";
18948
19279
  function findMediaStripItemElement(sectionId, index) {
18949
19280
  const sectionEl = findByInstanceId(sectionId);
18950
19281
  if (!sectionEl) return null;
@@ -18954,14 +19285,35 @@ function findMediaStripItemElement(sectionId, index) {
18954
19285
  }
18955
19286
  return null;
18956
19287
  }
18957
- function readRect2(ref) {
18958
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19288
+ function itemRefFromTarget(target) {
19289
+ if (!(target instanceof Element)) return null;
19290
+ if (target.closest(CHROME_SELECTOR)) return null;
19291
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19292
+ if (!itemEl) return null;
19293
+ const sectionEl = itemEl.closest("[data-ohw-section]");
19294
+ const unit = sectionEl ? movableUnit(sectionEl) : null;
19295
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19296
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19297
+ if (!sectionId || Number.isNaN(index)) return null;
19298
+ return { sectionId, index };
19299
+ }
19300
+ function sameRef(a, b) {
19301
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19302
+ }
19303
+ function rectOf(el) {
18959
19304
  if (!el) return null;
18960
19305
  const r2 = el.getBoundingClientRect();
18961
19306
  if (r2.width <= 0 || r2.height <= 0) return null;
18962
19307
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18963
19308
  }
18964
- function useLiveItemRect(ref) {
19309
+ function readRect2(ref) {
19310
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19311
+ }
19312
+ function readStripRect(ref) {
19313
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19314
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19315
+ }
19316
+ function useLiveItemRect(ref, strip = false) {
18965
19317
  const [rect, setRect] = useState8(null);
18966
19318
  useEffect8(() => {
18967
19319
  if (!ref) {
@@ -18969,7 +19321,7 @@ function useLiveItemRect(ref) {
18969
19321
  return;
18970
19322
  }
18971
19323
  const update = () => {
18972
- const next = readRect2(ref);
19324
+ const next = strip ? readStripRect(ref) : readRect2(ref);
18973
19325
  setRect(
18974
19326
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
18975
19327
  );
@@ -18984,9 +19336,49 @@ function useLiveItemRect(ref) {
18984
19336
  window.removeEventListener("resize", update);
18985
19337
  clearInterval(interval);
18986
19338
  };
18987
- }, [ref?.sectionId, ref?.index]);
19339
+ }, [ref?.sectionId, ref?.index, strip]);
18988
19340
  return rect;
18989
19341
  }
19342
+ var TOOLBAR_STRIP_GAP = 52;
19343
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19344
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19345
+ function StripToolbarSlot({ stripRect, children }) {
19346
+ const slotRef = useRef5(null);
19347
+ const [shift, setShift] = useState8(0);
19348
+ const centerX = stripRect.left + stripRect.width / 2;
19349
+ useLayoutEffect4(() => {
19350
+ const slot = slotRef.current;
19351
+ if (!slot) return;
19352
+ const clamp = () => {
19353
+ const w = slot.offsetWidth;
19354
+ if (w <= 0) return;
19355
+ const half = w / 2;
19356
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19357
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19358
+ };
19359
+ clamp();
19360
+ const ro = new ResizeObserver(clamp);
19361
+ ro.observe(slot);
19362
+ return () => ro.disconnect();
19363
+ }, [centerX, children]);
19364
+ const mobile = window.innerWidth <= 480;
19365
+ return /* @__PURE__ */ jsx21(
19366
+ "div",
19367
+ {
19368
+ ref: slotRef,
19369
+ "data-ohw-bridge": "",
19370
+ "data-ohw-item-interaction": "",
19371
+ className: "pointer-events-auto fixed",
19372
+ style: {
19373
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19374
+ left: centerX + shift,
19375
+ transform: "translate(-50%, -100%)",
19376
+ zIndex: 2147483645
19377
+ },
19378
+ children
19379
+ }
19380
+ );
19381
+ }
18990
19382
  function requestValidateTree(postToParent2, tree) {
18991
19383
  return new Promise((resolve) => {
18992
19384
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19023,116 +19415,72 @@ function requestAssetPick(postToParent2) {
19023
19415
  postToParent2({ type: "ow:asset-pick", id });
19024
19416
  });
19025
19417
  }
19026
- function Pill({
19418
+ function ToolbarAction({
19027
19419
  label,
19028
19420
  onClick,
19029
- disabled,
19030
- active
19421
+ disabled = false,
19422
+ active = false,
19423
+ children
19031
19424
  }) {
19032
- return /* @__PURE__ */ jsx20(
19033
- "button",
19034
- {
19035
- type: "button",
19036
- onClick,
19037
- disabled,
19038
- style: {
19039
- height: 28,
19040
- padding: "0 10px",
19041
- display: "inline-flex",
19042
- alignItems: "center",
19043
- gap: 4,
19044
- borderRadius: 999,
19045
- border: "none",
19046
- cursor: disabled ? "default" : "pointer",
19047
- background: active ? OHW_BLUE_DARK : "#ffffff",
19048
- color: active ? "#ffffff" : OHW_BLUE_DARK,
19049
- opacity: disabled ? 0.4 : 1,
19050
- fontSize: 12,
19051
- lineHeight: "16px",
19052
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19053
- whiteSpace: "nowrap",
19054
- flex: "0 0 auto"
19055
- },
19056
- children: label
19057
- }
19058
- );
19425
+ const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19426
+ return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19427
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19428
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19429
+ ] });
19059
19430
  }
19060
- function AltInput({ value, onCommit }) {
19061
- const [draft, setDraft] = useState8(value);
19062
- useEffect8(() => setDraft(value), [value]);
19063
- return /* @__PURE__ */ jsxs11(
19064
- "div",
19065
- {
19066
- style: {
19067
- display: "flex",
19068
- alignItems: "center",
19069
- gap: 6,
19070
- height: 28,
19071
- padding: "0 12px",
19072
- borderRadius: 999,
19073
- background: "#ffffff",
19074
- width: "100%",
19075
- maxWidth: 260,
19076
- boxSizing: "border-box"
19077
- },
19078
- children: [
19079
- /* @__PURE__ */ jsx20(
19080
- "span",
19081
- {
19082
- style: {
19083
- flex: "0 0 auto",
19084
- color: OHW_BLUE_DARK,
19085
- fontSize: 10,
19086
- fontWeight: 700,
19087
- textTransform: "uppercase",
19088
- letterSpacing: 0.4
19089
- },
19090
- children: "Alt"
19091
- }
19092
- ),
19093
- /* @__PURE__ */ jsx20(
19094
- "input",
19431
+ function ToolbarSeparator() {
19432
+ return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19433
+ }
19434
+ function OptionMenu({
19435
+ label,
19436
+ value,
19437
+ options,
19438
+ onChange
19439
+ }) {
19440
+ const current = options.find((o) => o.value === value) ?? options[0];
19441
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19442
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
19443
+ /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19444
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
19445
+ "button",
19446
+ {
19447
+ type: "button",
19448
+ "aria-label": label,
19449
+ 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",
19450
+ children: [
19451
+ /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19452
+ /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
19453
+ ]
19454
+ }
19455
+ ) }),
19456
+ /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19457
+ const selected = option.value === value;
19458
+ return /* @__PURE__ */ jsxs12(
19459
+ DropdownMenuItem,
19095
19460
  {
19096
- type: "text",
19097
- value: draft,
19098
- onChange: (e) => setDraft(e.target.value),
19099
- onBlur: () => {
19100
- if (draft !== value) onCommit(draft);
19101
- },
19102
- onKeyDown: (e) => {
19103
- if (e.key === "Enter") e.currentTarget.blur();
19104
- if (e.key === "Escape") {
19105
- setDraft(value);
19106
- e.currentTarget.blur();
19107
- }
19108
- },
19109
- placeholder: "Describe this image",
19110
- "aria-label": "Image alt text",
19111
- style: {
19112
- flex: 1,
19113
- minWidth: 0,
19114
- border: "none",
19115
- outline: "none",
19116
- background: "transparent",
19117
- fontSize: 12,
19118
- lineHeight: "16px",
19119
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19120
- color: "#1f2937"
19121
- }
19122
- }
19123
- )
19124
- ]
19125
- }
19126
- );
19461
+ role: "menuitemradio",
19462
+ "aria-checked": selected,
19463
+ onSelect: () => onChange(option.value),
19464
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19465
+ children: [
19466
+ /* @__PURE__ */ jsx21("span", { children: option.label }),
19467
+ selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
19468
+ ]
19469
+ },
19470
+ option.value
19471
+ );
19472
+ }) })
19473
+ ] })
19474
+ ] });
19127
19475
  }
19128
19476
  var VARIANTS = [
19129
19477
  { value: "logos", label: "Logos" },
19130
19478
  { value: "reel", label: "Reel" }
19131
19479
  ];
19132
19480
  var ALIGNS = [
19133
- { value: "left", label: "Left" },
19134
- { value: "center", label: "Center" },
19135
- { value: "right", label: "Right" }
19481
+ { value: "left", label: "Align left", Icon: AlignLeft },
19482
+ { value: "center", label: "Align center", Icon: AlignCenter },
19483
+ { value: "right", label: "Align right", Icon: AlignRight }
19136
19484
  ];
19137
19485
  var HOVERS = [
19138
19486
  { value: "none", label: "None" },
@@ -19140,104 +19488,104 @@ var HOVERS = [
19140
19488
  { value: "zoom", label: "Zoom" },
19141
19489
  { value: "fade", label: "Fade" }
19142
19490
  ];
19143
- var TREATMENTS = [
19144
- { value: "color", label: "Color" },
19145
- { value: "grayscale", label: "Grayscale" }
19146
- ];
19147
19491
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19148
- function LinkInput({ value, onCommit }) {
19149
- const [draft, setDraft] = useState8(value);
19492
+ function LinkModal({
19493
+ href,
19494
+ linkTarget,
19495
+ onClose,
19496
+ onSave
19497
+ }) {
19498
+ const [draft, setDraft] = useState8(href);
19499
+ const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
19150
19500
  const [invalid, setInvalid] = useState8(false);
19151
- useEffect8(() => {
19152
- setDraft(value);
19153
- setInvalid(false);
19154
- }, [value]);
19155
- const commit2 = () => {
19501
+ const save = () => {
19156
19502
  const next = draft.trim();
19157
- if (next === value) return setInvalid(false);
19158
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19159
- setInvalid(false);
19160
- onCommit(next);
19161
- };
19162
- return /* @__PURE__ */ jsxs11(
19163
- "div",
19164
- {
19165
- style: {
19166
- display: "flex",
19167
- alignItems: "center",
19168
- gap: 6,
19169
- height: 28,
19170
- padding: "0 12px",
19171
- borderRadius: 999,
19172
- background: "#ffffff",
19173
- width: "100%",
19174
- maxWidth: 260,
19175
- boxSizing: "border-box",
19176
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19177
- },
19178
- children: [
19179
- /* @__PURE__ */ jsx20(
19180
- "span",
19181
- {
19182
- style: {
19183
- flex: "0 0 auto",
19184
- color: OHW_BLUE_DARK,
19185
- fontSize: 10,
19186
- fontWeight: 700,
19187
- textTransform: "uppercase",
19188
- letterSpacing: 0.4
19189
- },
19190
- children: "Link"
19191
- }
19192
- ),
19193
- /* @__PURE__ */ jsx20(
19194
- "input",
19195
- {
19196
- type: "text",
19197
- inputMode: "url",
19198
- value: draft,
19199
- onChange: (e) => setDraft(e.target.value),
19200
- onBlur: commit2,
19201
- onKeyDown: (e) => {
19202
- if (e.key === "Enter") e.currentTarget.blur();
19203
- if (e.key === "Escape") {
19204
- setDraft(value);
19205
- setInvalid(false);
19206
- e.currentTarget.blur();
19207
- }
19208
- },
19209
- placeholder: "https://example.com",
19210
- "aria-label": "Image link URL",
19211
- "aria-invalid": invalid,
19212
- style: {
19213
- flex: 1,
19214
- minWidth: 0,
19215
- border: "none",
19216
- outline: "none",
19217
- background: "transparent",
19218
- fontSize: 12,
19219
- lineHeight: "16px",
19220
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19221
- color: "#1f2937"
19222
- }
19223
- }
19224
- )
19225
- ]
19503
+ if (next && !HTTP_URL_RE.test(next)) {
19504
+ setInvalid(true);
19505
+ return;
19226
19506
  }
19227
- );
19507
+ onSave(next, newTab ? "new-tab" : "same-tab");
19508
+ onClose();
19509
+ };
19510
+ return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
19511
+ /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
19512
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
19513
+ /* @__PURE__ */ jsx21(
19514
+ "input",
19515
+ {
19516
+ autoFocus: true,
19517
+ type: "text",
19518
+ inputMode: "url",
19519
+ value: draft,
19520
+ onChange: (e) => {
19521
+ setDraft(e.target.value);
19522
+ setInvalid(false);
19523
+ },
19524
+ onKeyDown: (e) => {
19525
+ if (e.key === "Enter") save();
19526
+ },
19527
+ placeholder: "https://example.com",
19528
+ "aria-label": "Image link URL",
19529
+ "aria-invalid": invalid,
19530
+ className: cn(
19531
+ "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",
19532
+ invalid && "border-destructive focus:border-destructive"
19533
+ )
19534
+ }
19535
+ ),
19536
+ invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19537
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19538
+ /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19539
+ "Open in new tab"
19540
+ ] })
19541
+ ] }),
19542
+ /* @__PURE__ */ jsxs12(DialogFooter, { children: [
19543
+ href && /* @__PURE__ */ jsx21(
19544
+ "button",
19545
+ {
19546
+ type: "button",
19547
+ onClick: () => {
19548
+ onSave("", "new-tab");
19549
+ onClose();
19550
+ },
19551
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19552
+ children: "Remove link"
19553
+ }
19554
+ ),
19555
+ /* @__PURE__ */ jsx21(
19556
+ "button",
19557
+ {
19558
+ type: "button",
19559
+ onClick: onClose,
19560
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19561
+ children: "Cancel"
19562
+ }
19563
+ ),
19564
+ /* @__PURE__ */ jsx21(
19565
+ "button",
19566
+ {
19567
+ type: "button",
19568
+ onClick: save,
19569
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19570
+ children: "Save"
19571
+ }
19572
+ )
19573
+ ] })
19574
+ ] }) });
19228
19575
  }
19229
19576
  function MediaStripToolbar({
19230
19577
  entry,
19231
19578
  index,
19232
19579
  pending,
19233
19580
  error,
19581
+ itemEditOn,
19582
+ onToggleItemEdit,
19234
19583
  onSetVariant,
19235
19584
  onSetAlign,
19236
19585
  onSetHover,
19237
19586
  onSetTreatment,
19238
19587
  onResize,
19239
- onSetAlt,
19240
- onSetLink,
19588
+ onOpenLink,
19241
19589
  onAddItem,
19242
19590
  onRemoveItem,
19243
19591
  onChangeImage,
@@ -19246,81 +19594,102 @@ function MediaStripToolbar({
19246
19594
  }) {
19247
19595
  const items = mediaStripItems(entry.tree);
19248
19596
  const itemCount = items.length;
19249
- const currentAlt = items[index]?.alt ?? "";
19250
- const currentHref2 = items[index]?.href ?? "";
19251
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19252
19597
  const slots = findMediaStripSlots(entry.tree);
19253
19598
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19254
19599
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19255
19600
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19256
19601
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19257
19602
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19258
- const isMobile = window.innerWidth <= 480;
19259
- const rowStyle = isMobile ? {
19260
- display: "flex",
19261
- gap: 6,
19262
- flexWrap: "nowrap",
19263
- justifyContent: "center",
19264
- overflowX: "auto",
19265
- WebkitOverflowScrolling: "touch",
19266
- width: "100%",
19267
- scrollbarWidth: "none"
19268
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19269
- return /* @__PURE__ */ jsxs11(
19603
+ const mobile = window.innerWidth <= 480;
19604
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19605
+ return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
19270
19606
  "div",
19271
19607
  {
19272
19608
  "data-ohw-bridge": "",
19273
19609
  "data-ohw-toolbar": "",
19274
19610
  onMouseDown: (e) => e.stopPropagation(),
19275
- style: {
19276
- display: "flex",
19277
- flexDirection: "column",
19278
- gap: 6,
19279
- alignItems: "center",
19280
- background: OHW_BLUE,
19281
- padding: 8,
19282
- borderRadius: 12,
19283
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19284
- pointerEvents: pending ? "none" : "auto",
19285
- opacity: pending ? 0.6 : 1,
19286
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19287
- },
19611
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19612
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19288
19613
  children: [
19289
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19290
- VARIANTS.map((v) => /* @__PURE__ */ jsx20(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19291
- ALIGNS.map((a) => /* @__PURE__ */ jsx20(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19292
- ] }),
19293
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19294
- HOVERS.map((h) => /* @__PURE__ */ jsx20(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19295
- TREATMENTS.map((t) => /* @__PURE__ */ jsx20(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19296
- ] }),
19297
- /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19298
- /* @__PURE__ */ jsx20(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19299
- /* @__PURE__ */ jsxs11("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19300
- sizeValue,
19301
- "px"
19302
- ] }),
19303
- /* @__PURE__ */ jsx20(Pill, { label: "+", onClick: () => onResize(8) })
19304
- ] }),
19305
- /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19306
- /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19307
- currentHref2 && /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19308
- /* @__PURE__ */ jsx20(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19309
- /* @__PURE__ */ jsx20(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19310
- ] }),
19311
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19312
- /* @__PURE__ */ jsx20(Pill, { label: "Change Image", onClick: onChangeImage }),
19313
- /* @__PURE__ */ jsx20(Pill, { label: "+ Item", onClick: onAddItem }),
19314
- /* @__PURE__ */ jsx20(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19315
- ] }),
19316
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19317
- /* @__PURE__ */ jsx20(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19318
- /* @__PURE__ */ jsx20(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19319
- ] }),
19320
- error && /* @__PURE__ */ jsx20("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19614
+ /* @__PURE__ */ jsxs12(
19615
+ "div",
19616
+ {
19617
+ className: cn(
19618
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19619
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19620
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
19621
+ ),
19622
+ children: [
19623
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
19624
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
19625
+ CustomToolbarButton,
19626
+ {
19627
+ type: "button",
19628
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19629
+ "aria-pressed": itemEditOn,
19630
+ onClick: onToggleItemEdit,
19631
+ className: "group size-8",
19632
+ children: /* @__PURE__ */ jsx21(
19633
+ Star,
19634
+ {
19635
+ size: 16,
19636
+ fill: "currentColor",
19637
+ strokeWidth: 0,
19638
+ className: cn(
19639
+ "transition-colors",
19640
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19641
+ ),
19642
+ style: { pointerEvents: "none" }
19643
+ }
19644
+ )
19645
+ }
19646
+ ) }),
19647
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19648
+ ] }),
19649
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19650
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
19651
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
19652
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
19653
+ /* @__PURE__ */ jsx21(
19654
+ ToolbarAction,
19655
+ {
19656
+ label: gatedLabel("Move right"),
19657
+ onClick: onMoveRight,
19658
+ disabled: !itemEditOn || index >= itemCount - 1,
19659
+ children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
19660
+ }
19661
+ ),
19662
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19663
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19664
+ /* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19665
+ /* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19666
+ /* @__PURE__ */ jsx21(
19667
+ ToolbarAction,
19668
+ {
19669
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19670
+ active: treatment === "grayscale",
19671
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19672
+ children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
19673
+ }
19674
+ ),
19675
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19676
+ ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
19677
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19678
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19679
+ /* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19680
+ sizeValue,
19681
+ "px"
19682
+ ] }),
19683
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
19684
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19685
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19686
+ ]
19687
+ }
19688
+ ),
19689
+ error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19321
19690
  ]
19322
19691
  }
19323
- );
19692
+ ) });
19324
19693
  }
19325
19694
  function findMediaStripSlots(tree) {
19326
19695
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19339,31 +19708,23 @@ function AiMediaStripOverlay({
19339
19708
  }) {
19340
19709
  const [hover, setHover] = useState8(null);
19341
19710
  const [active, setActive] = useState8(null);
19711
+ const [itemEditOn, setItemEditOn] = useState8(false);
19712
+ const [linkOpen, setLinkOpen] = useState8(false);
19342
19713
  const [pending, setPending] = useState8(false);
19343
19714
  const [error, setError] = useState8(null);
19344
19715
  const activeRef = useRef5(null);
19345
19716
  activeRef.current = active;
19717
+ const linkOpenRef = useRef5(false);
19718
+ linkOpenRef.current = linkOpen;
19346
19719
  useEffect8(() => {
19347
19720
  const onMove = (e) => {
19721
+ const ref = itemRefFromTarget(e.target);
19348
19722
  const t = e.target;
19349
- if (!(t instanceof HTMLElement)) return;
19350
- 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]")) {
19351
- return;
19352
- }
19353
- const itemEl = t.closest("[data-ohw-media-strip-item]");
19354
- if (!itemEl) {
19355
- setHover(null);
19356
- return;
19357
- }
19358
- const sectionEl = itemEl.closest("[data-ohw-section]");
19359
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19360
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19361
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19362
- if (!sectionId || Number.isNaN(index)) {
19363
- setHover(null);
19364
- return;
19365
- }
19366
- setHover({ sectionId, index });
19723
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19724
+ setHover((prev) => {
19725
+ const next = ref && !overEditable ? ref : null;
19726
+ return sameRef(prev, next) ? prev : next;
19727
+ });
19367
19728
  };
19368
19729
  const onLeave = () => setHover(null);
19369
19730
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19375,23 +19736,25 @@ function AiMediaStripOverlay({
19375
19736
  }, []);
19376
19737
  useEffect8(() => {
19377
19738
  const onClick = (e) => {
19378
- const current = activeRef.current;
19379
- if (!current) return;
19380
19739
  const t = e.target;
19381
- if (!(t instanceof HTMLElement)) return;
19382
- if (t.closest("[data-ohw-item-interaction]")) return;
19383
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19384
- if (itemEl && itemEl.contains(t)) return;
19385
- setActive(null);
19740
+ if (!(t instanceof Element)) return;
19741
+ if (t.closest(CHROME_SELECTOR)) return;
19742
+ const ref = itemRefFromTarget(t);
19743
+ if (sameRef(activeRef.current, ref)) return;
19744
+ if (ref) clearInteractionChromeRef.current();
19745
+ setItemEditOn(false);
19386
19746
  setError(null);
19747
+ setActive(ref);
19387
19748
  };
19388
19749
  document.addEventListener("click", onClick, true);
19389
19750
  return () => document.removeEventListener("click", onClick, true);
19390
- }, []);
19751
+ }, [clearInteractionChromeRef]);
19391
19752
  useEffect8(() => {
19392
19753
  const onBlur = () => {
19393
19754
  if (!activeRef.current) return;
19394
19755
  setActive(null);
19756
+ setItemEditOn(false);
19757
+ setLinkOpen(false);
19395
19758
  setError(null);
19396
19759
  };
19397
19760
  window.addEventListener("blur", onBlur);
@@ -19401,7 +19764,10 @@ function AiMediaStripOverlay({
19401
19764
  const onKeyDown = (e) => {
19402
19765
  if (e.key !== "Escape") return;
19403
19766
  if (!activeRef.current) return;
19767
+ if (linkOpenRef.current) return;
19768
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19404
19769
  setActive(null);
19770
+ setItemEditOn(false);
19405
19771
  setError(null);
19406
19772
  };
19407
19773
  document.addEventListener("keydown", onKeyDown);
@@ -19435,137 +19801,133 @@ function AiMediaStripOverlay({
19435
19801
  tree: nextTree,
19436
19802
  label: entry.label,
19437
19803
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19438
- ...entry.brand ? { brand: entry.brand } : {}
19804
+ ...entry.brand ? { brand: entry.brand } : {},
19805
+ // The user is already looking at the strip they just edited — recentering the viewport
19806
+ // on every edit reads as the section jumping around.
19807
+ skipScrollIntoView: true
19439
19808
  });
19440
19809
  return true;
19441
19810
  },
19442
19811
  [findEntry, postToParent2, applyTreeLocalRef]
19443
19812
  );
19444
19813
  const activeEntry = active ? findEntry(active.sectionId) : null;
19445
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19446
19814
  const activeItemRect = useLiveItemRect(active);
19447
- const TOOLBAR_APPROX_H = 170;
19448
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19449
- return /* @__PURE__ */ jsxs11(Fragment7, { children: [
19450
- hoverHandleRect && hover && /* @__PURE__ */ jsx20(
19451
- "button",
19452
- {
19453
- type: "button",
19454
- "data-ohw-toolbar": "",
19455
- onClick: () => {
19456
- clearInteractionChromeRef.current();
19457
- setActive(hover);
19458
- },
19459
- "aria-label": "Configure media item",
19460
- style: {
19461
- position: "fixed",
19462
- top: hoverHandleRect.top + 8,
19463
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
19464
- width: 28,
19465
- height: 28,
19466
- borderRadius: 8,
19467
- border: `1.5px dashed ${PRIMARY3}`,
19468
- background: "#ffffff",
19469
- color: PRIMARY3,
19470
- display: "flex",
19471
- alignItems: "center",
19472
- justifyContent: "center",
19473
- cursor: "pointer",
19474
- zIndex: 2147483643,
19475
- fontSize: 14,
19476
- fontWeight: 700
19477
- },
19478
- children: /* @__PURE__ */ jsx20(Star, { size: 14, style: { pointerEvents: "none" } })
19479
- }
19480
- ),
19481
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
19482
- ItemInteractionLayer,
19483
- {
19484
- rect: activeItemRect,
19485
- state: toolbarState,
19486
- toolbar: /* @__PURE__ */ jsx20(
19487
- MediaStripToolbar,
19488
- {
19489
- entry: activeEntry,
19490
- index: active.index,
19491
- pending,
19492
- error,
19493
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19494
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19495
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19496
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19497
- onResize: (delta) => {
19498
- const slots = findMediaStripSlots(activeEntry.tree);
19499
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19500
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19501
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19502
- },
19503
- onSetAlt: (alt) => {
19504
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19505
- },
19506
- onSetLink: (href, linkTarget) => {
19815
+ const activeStripRect = useLiveItemRect(active, true);
19816
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
19817
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
19818
+ const activeItem = active ? activeItems[active.index] : void 0;
19819
+ const activeHref = activeItem?.href ?? "";
19820
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19821
+ return /* @__PURE__ */ jsxs12(Fragment7, { children: [
19822
+ hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19823
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
19824
+ /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
19825
+ /* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
19826
+ MediaStripToolbar,
19827
+ {
19828
+ entry: activeEntry,
19829
+ index: active.index,
19830
+ pending,
19831
+ error,
19832
+ itemEditOn,
19833
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
19834
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19835
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19836
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19837
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19838
+ onResize: (delta) => {
19839
+ const slots = findMediaStripSlots(activeEntry.tree);
19840
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19841
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19842
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19843
+ },
19844
+ onOpenLink: () => setLinkOpen(true),
19845
+ onAddItem: () => {
19846
+ void requestAssetPick(postToParent2).then((picked) => {
19847
+ if (!picked) return;
19848
+ const item = { assetId: picked.assetId, alt: "Logo" };
19507
19849
  void runMutation(
19508
19850
  active.sectionId,
19509
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19510
- );
19511
- },
19512
- onAddItem: () => {
19513
- void requestAssetPick(postToParent2).then((picked) => {
19514
- if (!picked) return;
19515
- const item = { assetId: picked.assetId, alt: "Logo" };
19516
- void runMutation(
19517
- active.sectionId,
19518
- (tree) => addMediaStripItem(tree, item, active.index),
19519
- { [picked.assetId]: picked.url }
19520
- ).then((applied) => {
19521
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19522
- });
19851
+ (tree) => addMediaStripItem(tree, item, active.index),
19852
+ { [picked.assetId]: picked.url }
19853
+ ).then((applied) => {
19854
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19523
19855
  });
19524
- },
19525
- onChangeImage: () => {
19526
- void requestAssetPick(postToParent2).then((picked) => {
19527
- if (!picked) return;
19528
- void runMutation(
19529
- active.sectionId,
19530
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19531
- { [picked.assetId]: picked.url }
19532
- );
19533
- });
19534
- },
19535
- onRemoveItem: () => {
19536
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19537
- (applied) => {
19538
- if (applied) setActive(null);
19539
- }
19540
- );
19541
- },
19542
- onMoveLeft: () => {
19543
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19544
- (applied) => {
19545
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19546
- }
19547
- );
19548
- },
19549
- onMoveRight: () => {
19550
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19551
- (applied) => {
19552
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19553
- }
19856
+ });
19857
+ },
19858
+ onChangeImage: () => {
19859
+ void requestAssetPick(postToParent2).then((picked) => {
19860
+ if (!picked) return;
19861
+ void runMutation(
19862
+ active.sectionId,
19863
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19864
+ { [picked.assetId]: picked.url }
19554
19865
  );
19555
- }
19866
+ });
19867
+ },
19868
+ onRemoveItem: () => {
19869
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19870
+ (applied) => {
19871
+ if (applied) setActive(null);
19872
+ }
19873
+ );
19874
+ },
19875
+ onMoveLeft: () => {
19876
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19877
+ (applied) => {
19878
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19879
+ }
19880
+ );
19881
+ },
19882
+ onMoveRight: () => {
19883
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19884
+ (applied) => {
19885
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19886
+ }
19887
+ );
19556
19888
  }
19557
- )
19558
- }
19559
- )
19889
+ }
19890
+ ) }),
19891
+ /* @__PURE__ */ jsx21(
19892
+ "div",
19893
+ {
19894
+ "data-ohw-bridge": "",
19895
+ "data-ohw-item-interaction": "",
19896
+ "aria-hidden": true,
19897
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
19898
+ style: {
19899
+ top: activeItemRect.top + activeItemRect.height + 10,
19900
+ left: activeItemRect.left - 5,
19901
+ background: PRIMARY3,
19902
+ zIndex: 2147483644
19903
+ },
19904
+ children: "Media item"
19905
+ }
19906
+ ),
19907
+ linkOpen && /* @__PURE__ */ jsx21(
19908
+ LinkModal,
19909
+ {
19910
+ href: activeHref,
19911
+ linkTarget: activeTarget,
19912
+ onClose: () => setLinkOpen(false),
19913
+ onSave: (href, linkTarget) => {
19914
+ void runMutation(
19915
+ active.sectionId,
19916
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19917
+ );
19918
+ }
19919
+ }
19920
+ )
19921
+ ] })
19560
19922
  ] });
19561
19923
  }
19562
19924
 
19563
19925
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19564
- import { useCallback as useCallback4, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
19565
- import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
19566
- import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19926
+ import { useCallback as useCallback4, useEffect as useEffect9, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
19927
+ import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
19928
+ import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
19567
19929
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19568
- 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]";
19930
+ 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]";
19569
19931
  function findPricingCardElement(sectionId, index) {
19570
19932
  const sectionEl = findByInstanceId(sectionId);
19571
19933
  if (!sectionEl) return null;
@@ -19577,7 +19939,7 @@ function findPricingCardElement(sectionId, index) {
19577
19939
  }
19578
19940
  function cardRefFromTarget(target) {
19579
19941
  if (!(target instanceof Element)) return null;
19580
- if (target.closest(CHROME_SELECTOR)) return null;
19942
+ if (target.closest(CHROME_SELECTOR2)) return null;
19581
19943
  const cardEl = target.closest("[data-ohw-pricing-card]");
19582
19944
  if (!cardEl) return null;
19583
19945
  const sectionEl = cardEl.closest("[data-ohw-section]");
@@ -19587,21 +19949,21 @@ function cardRefFromTarget(target) {
19587
19949
  if (!sectionId || Number.isNaN(index)) return null;
19588
19950
  return { sectionId, index };
19589
19951
  }
19590
- function sameRef(a, b) {
19952
+ function sameRef2(a, b) {
19591
19953
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19592
19954
  }
19593
- function rectOf(el) {
19955
+ function rectOf2(el) {
19594
19956
  if (!el) return null;
19595
19957
  const r2 = el.getBoundingClientRect();
19596
19958
  if (r2.width <= 0 || r2.height <= 0) return null;
19597
19959
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19598
19960
  }
19599
19961
  function readRect3(ref) {
19600
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
19962
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19601
19963
  }
19602
19964
  function readGridRect(ref) {
19603
19965
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19604
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
19966
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19605
19967
  }
19606
19968
  function useLiveCardRect(ref, grid = false) {
19607
19969
  const [rect, setRect] = useState9(null);
@@ -19631,19 +19993,19 @@ function useLiveCardRect(ref, grid = false) {
19631
19993
  }
19632
19994
  var TOOLBAR_GRID_GAP = 52;
19633
19995
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19634
- var TOOLBAR_EDGE_MARGIN2 = 4;
19996
+ var TOOLBAR_EDGE_MARGIN3 = 4;
19635
19997
  function GridToolbarSlot({ gridRect, children }) {
19636
19998
  const slotRef = useRef6(null);
19637
19999
  const [shift, setShift] = useState9(0);
19638
20000
  const centerX = gridRect.left + gridRect.width / 2;
19639
- useLayoutEffect4(() => {
20001
+ useLayoutEffect5(() => {
19640
20002
  const slot = slotRef.current;
19641
20003
  if (!slot) return;
19642
20004
  const clamp = () => {
19643
20005
  const w = slot.offsetWidth;
19644
20006
  if (w <= 0) return;
19645
20007
  const half = w / 2;
19646
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20008
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19647
20009
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19648
20010
  };
19649
20011
  clamp();
@@ -19652,7 +20014,7 @@ function GridToolbarSlot({ gridRect, children }) {
19652
20014
  return () => ro.disconnect();
19653
20015
  }, [centerX, children]);
19654
20016
  const mobile = window.innerWidth <= 480;
19655
- return /* @__PURE__ */ jsx21(
20017
+ return /* @__PURE__ */ jsx22(
19656
20018
  "div",
19657
20019
  {
19658
20020
  ref: slotRef,
@@ -19687,7 +20049,7 @@ function requestValidateTree2(postToParent2, tree) {
19687
20049
  });
19688
20050
  }
19689
20051
  function StyleSwatch({ style }) {
19690
- return /* @__PURE__ */ jsx21(
20052
+ return /* @__PURE__ */ jsx22(
19691
20053
  "span",
19692
20054
  {
19693
20055
  "aria-hidden": true,
@@ -19701,35 +20063,35 @@ function StyleSwatch({ style }) {
19701
20063
  );
19702
20064
  }
19703
20065
  function ButtonGlyph() {
19704
- return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19705
- /* @__PURE__ */ jsx21("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19706
- /* @__PURE__ */ jsx21("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20066
+ return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20067
+ /* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20068
+ /* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19707
20069
  ] });
19708
20070
  }
19709
20071
  function FeatureGlyph({ mode }) {
19710
- return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19711
- /* @__PURE__ */ jsx21("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19712
- /* @__PURE__ */ jsx21("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19713
- /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19714
- /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19715
- /* @__PURE__ */ jsx21("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19716
- mode === "add" && /* @__PURE__ */ jsx21("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20072
+ return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20073
+ /* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20074
+ /* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20075
+ /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20076
+ /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20077
+ /* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20078
+ mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19717
20079
  ] });
19718
20080
  }
19719
- function ToolbarAction({
20081
+ function ToolbarAction2({
19720
20082
  label,
19721
20083
  onClick,
19722
20084
  disabled = false,
19723
20085
  children
19724
20086
  }) {
19725
- const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19726
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19727
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19728
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20087
+ const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20088
+ return /* @__PURE__ */ jsxs13(Tooltip, { children: [
20089
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
20090
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19729
20091
  ] });
19730
20092
  }
19731
- function ToolbarSeparator() {
19732
- return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20093
+ function ToolbarSeparator2() {
20094
+ return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19733
20095
  }
19734
20096
  function CardStyleMenu({
19735
20097
  value,
@@ -19737,7 +20099,7 @@ function CardStyleMenu({
19737
20099
  disabled = false
19738
20100
  }) {
19739
20101
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
19740
- const trigger = /* @__PURE__ */ jsxs12(
20102
+ const trigger = /* @__PURE__ */ jsxs13(
19741
20103
  "button",
19742
20104
  {
19743
20105
  type: "button",
@@ -19748,28 +20110,28 @@ function CardStyleMenu({
19748
20110
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
19749
20111
  ),
19750
20112
  children: [
19751
- /* @__PURE__ */ jsx21(StyleSwatch, { style: current.value }),
19752
- /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19753
- /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20113
+ /* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
20114
+ /* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
20115
+ /* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
19754
20116
  ]
19755
20117
  }
19756
20118
  );
19757
20119
  if (disabled) {
19758
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19759
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
19760
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19761
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: trigger }) }),
19762
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20120
+ return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20121
+ /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20122
+ /* @__PURE__ */ jsxs13(Tooltip, { children: [
20123
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
20124
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
19763
20125
  ] })
19764
20126
  ] });
19765
20127
  }
19766
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19767
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
19768
- /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19769
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: trigger }),
19770
- /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20128
+ return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20129
+ /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20130
+ /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
20131
+ /* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
20132
+ /* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
19771
20133
  const selected = style.value === value;
19772
- return /* @__PURE__ */ jsxs12(
20134
+ return /* @__PURE__ */ jsxs13(
19773
20135
  DropdownMenuItem,
19774
20136
  {
19775
20137
  role: "menuitemradio",
@@ -19777,9 +20139,9 @@ function CardStyleMenu({
19777
20139
  onSelect: () => onChange(style.value),
19778
20140
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19779
20141
  children: [
19780
- /* @__PURE__ */ jsx21(StyleSwatch, { style: style.value }),
19781
- /* @__PURE__ */ jsx21("span", { children: style.label }),
19782
- selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20142
+ /* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
20143
+ /* @__PURE__ */ jsx22("span", { children: style.label }),
20144
+ selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
19783
20145
  ]
19784
20146
  },
19785
20147
  style.value
@@ -19809,7 +20171,7 @@ function PricingCardToolbar({
19809
20171
  const style = pricingCardStyle(entry.tree, index);
19810
20172
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
19811
20173
  const mobile = window.innerWidth <= 480;
19812
- return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
20174
+ return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
19813
20175
  "div",
19814
20176
  {
19815
20177
  "data-ohw-bridge": "",
@@ -19821,7 +20183,7 @@ function PricingCardToolbar({
19821
20183
  ),
19822
20184
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19823
20185
  children: [
19824
- /* @__PURE__ */ jsxs12(
20186
+ /* @__PURE__ */ jsxs13(
19825
20187
  "div",
19826
20188
  {
19827
20189
  className: cn(
@@ -19830,8 +20192,8 @@ function PricingCardToolbar({
19830
20192
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
19831
20193
  ),
19832
20194
  children: [
19833
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19834
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20195
+ /* @__PURE__ */ jsxs13(Tooltip, { children: [
20196
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
19835
20197
  CustomToolbarButton,
19836
20198
  {
19837
20199
  type: "button",
@@ -19839,7 +20201,7 @@ function PricingCardToolbar({
19839
20201
  "aria-pressed": featuredTag,
19840
20202
  onClick: () => onSetFeaturedTag(!featuredTag),
19841
20203
  className: "group size-8",
19842
- children: /* @__PURE__ */ jsx21(
20204
+ children: /* @__PURE__ */ jsx22(
19843
20205
  Star2,
19844
20206
  {
19845
20207
  size: 16,
@@ -19854,25 +20216,25 @@ function PricingCardToolbar({
19854
20216
  )
19855
20217
  }
19856
20218
  ) }),
19857
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20219
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
19858
20220
  ] }),
19859
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19860
- /* @__PURE__ */ jsx21(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
19861
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19862
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx21(ButtonGlyph, {}) }),
19863
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
19864
- /* @__PURE__ */ jsx21(ButtonGlyph, {}),
19865
- /* @__PURE__ */ jsx21(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20221
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20222
+ /* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20223
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20224
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
20225
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
20226
+ /* @__PURE__ */ jsx22(ButtonGlyph, {}),
20227
+ /* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
19866
20228
  ] }) }),
19867
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "add" }) }),
19868
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "remove" }) }),
19869
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19870
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
19871
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) })
20229
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
20230
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
20231
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20232
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
20233
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
19872
20234
  ]
19873
20235
  }
19874
20236
  ),
19875
- error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20237
+ error && /* @__PURE__ */ jsx22("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19876
20238
  ]
19877
20239
  }
19878
20240
  ) });
@@ -19906,7 +20268,7 @@ function AiPricingCardOverlay({
19906
20268
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
19907
20269
  setHover((prev) => {
19908
20270
  const next = ref && !overEditable ? ref : null;
19909
- return sameRef(prev, next) ? prev : next;
20271
+ return sameRef2(prev, next) ? prev : next;
19910
20272
  });
19911
20273
  };
19912
20274
  const onLeave = () => setHover(null);
@@ -19921,10 +20283,10 @@ function AiPricingCardOverlay({
19921
20283
  const onClick = (e) => {
19922
20284
  const t = e.target;
19923
20285
  if (!(t instanceof Element)) return;
19924
- if (t.closest(CHROME_SELECTOR)) return;
20286
+ if (t.closest(CHROME_SELECTOR2)) return;
19925
20287
  const ref = cardRefFromTarget(t);
19926
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
19927
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20288
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20289
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
19928
20290
  };
19929
20291
  document.addEventListener("click", onClick, true);
19930
20292
  return () => document.removeEventListener("click", onClick, true);
@@ -19989,12 +20351,12 @@ function AiPricingCardOverlay({
19989
20351
  const activeEntry = active ? findEntry(active.sectionId) : null;
19990
20352
  const activeCardRect = useLiveCardRect(active);
19991
20353
  const activeGridRect = useLiveCardRect(active, true);
19992
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
19993
- return /* @__PURE__ */ jsxs12(Fragment8, { children: [
19994
- hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19995
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
19996
- /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
19997
- /* @__PURE__ */ jsx21(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx21(
20354
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20355
+ return /* @__PURE__ */ jsxs13(Fragment8, { children: [
20356
+ hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20357
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
20358
+ /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20359
+ /* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
19998
20360
  PricingCardToolbar,
19999
20361
  {
20000
20362
  entry: activeEntry,
@@ -20022,7 +20384,7 @@ function AiPricingCardOverlay({
20022
20384
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20023
20385
  }
20024
20386
  ) }),
20025
- /* @__PURE__ */ jsx21(
20387
+ /* @__PURE__ */ jsx22(
20026
20388
  "div",
20027
20389
  {
20028
20390
  "data-ohw-bridge": "",
@@ -20086,39 +20448,11 @@ function clearVideo(tree, path) {
20086
20448
  });
20087
20449
  }
20088
20450
 
20089
- // src/lib/youtube.ts
20090
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20091
- function extractYouTubeId(input) {
20092
- const trimmed = input.trim();
20093
- if (!trimmed) return null;
20094
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20095
- let url;
20096
- try {
20097
- url = new URL(trimmed);
20098
- } catch {
20099
- return null;
20100
- }
20101
- const host = url.hostname.replace(/^www\./, "");
20102
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20103
- return null;
20104
- }
20105
- let candidate = null;
20106
- if (host === "youtu.be") {
20107
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20108
- } else if (url.pathname === "/watch") {
20109
- candidate = url.searchParams.get("v");
20110
- } else {
20111
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20112
- candidate = match ? match[1] : null;
20113
- }
20114
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20115
- }
20116
-
20117
20451
  // src/ui/ai-section/AiVideoOverlay.tsx
20118
- import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
20452
+ import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20119
20453
  var PRIMARY5 = "#0885FE";
20120
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20121
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20454
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20455
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20122
20456
  function findVideoBlockElement(sectionId, path) {
20123
20457
  const sectionEl = findByInstanceId(sectionId);
20124
20458
  if (!sectionEl) return null;
@@ -20178,12 +20512,12 @@ function requestValidateTree3(postToParent2, tree) {
20178
20512
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20179
20513
  });
20180
20514
  }
20181
- function Pill2({
20515
+ function Pill({
20182
20516
  label,
20183
20517
  onClick,
20184
20518
  disabled
20185
20519
  }) {
20186
- return /* @__PURE__ */ jsx22(
20520
+ return /* @__PURE__ */ jsx23(
20187
20521
  "button",
20188
20522
  {
20189
20523
  type: "button",
@@ -20199,7 +20533,7 @@ function Pill2({
20199
20533
  border: "none",
20200
20534
  cursor: disabled ? "default" : "pointer",
20201
20535
  background: "#ffffff",
20202
- color: OHW_BLUE_DARK2,
20536
+ color: OHW_BLUE_DARK,
20203
20537
  opacity: disabled ? 0.4 : 1,
20204
20538
  fontSize: 12,
20205
20539
  lineHeight: "16px",
@@ -20242,8 +20576,8 @@ function VideoUrlInput({ value, onCommit }) {
20242
20576
  onCommit(id);
20243
20577
  }
20244
20578
  };
20245
- return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20246
- /* @__PURE__ */ jsxs13(
20579
+ return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20580
+ /* @__PURE__ */ jsxs14(
20247
20581
  "div",
20248
20582
  {
20249
20583
  style: {
@@ -20259,12 +20593,12 @@ function VideoUrlInput({ value, onCommit }) {
20259
20593
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20260
20594
  },
20261
20595
  children: [
20262
- /* @__PURE__ */ jsx22(
20596
+ /* @__PURE__ */ jsx23(
20263
20597
  "span",
20264
20598
  {
20265
20599
  style: {
20266
20600
  flex: "0 0 auto",
20267
- color: OHW_BLUE_DARK2,
20601
+ color: OHW_BLUE_DARK,
20268
20602
  fontSize: 10,
20269
20603
  lineHeight: "16px",
20270
20604
  fontWeight: 700,
@@ -20274,7 +20608,7 @@ function VideoUrlInput({ value, onCommit }) {
20274
20608
  children: "Video"
20275
20609
  }
20276
20610
  ),
20277
- /* @__PURE__ */ jsx22(
20611
+ /* @__PURE__ */ jsx23(
20278
20612
  "input",
20279
20613
  {
20280
20614
  type: "text",
@@ -20311,7 +20645,7 @@ function VideoUrlInput({ value, onCommit }) {
20311
20645
  ]
20312
20646
  }
20313
20647
  ),
20314
- invalid && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20648
+ invalid && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20315
20649
  ] });
20316
20650
  }
20317
20651
  function VideoToolbar({
@@ -20321,7 +20655,7 @@ function VideoToolbar({
20321
20655
  onSetVideoId,
20322
20656
  onRemove
20323
20657
  }) {
20324
- return /* @__PURE__ */ jsxs13(
20658
+ return /* @__PURE__ */ jsxs14(
20325
20659
  "div",
20326
20660
  {
20327
20661
  "data-ohw-bridge": "",
@@ -20333,7 +20667,7 @@ function VideoToolbar({
20333
20667
  gap: 6,
20334
20668
  alignItems: "center",
20335
20669
  width: 280,
20336
- background: OHW_BLUE2,
20670
+ background: OHW_BLUE,
20337
20671
  padding: 8,
20338
20672
  borderRadius: 12,
20339
20673
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20341,9 +20675,9 @@ function VideoToolbar({
20341
20675
  opacity: pending ? 0.6 : 1
20342
20676
  },
20343
20677
  children: [
20344
- /* @__PURE__ */ jsx22(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20345
- /* @__PURE__ */ jsx22(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20346
- error && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20678
+ /* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20679
+ /* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20680
+ error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20347
20681
  ]
20348
20682
  }
20349
20683
  );
@@ -20463,8 +20797,8 @@ function AiVideoOverlay({
20463
20797
  const activeBlockRect = useLiveBlockRect(active);
20464
20798
  const TOOLBAR_APPROX_H = 90;
20465
20799
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20466
- return /* @__PURE__ */ jsxs13(Fragment9, { children: [
20467
- hoverHandleRect && hover && /* @__PURE__ */ jsx22(
20800
+ return /* @__PURE__ */ jsxs14(Fragment9, { children: [
20801
+ hoverHandleRect && hover && /* @__PURE__ */ jsx23(
20468
20802
  "button",
20469
20803
  {
20470
20804
  type: "button",
@@ -20492,15 +20826,15 @@ function AiVideoOverlay({
20492
20826
  fontSize: 14,
20493
20827
  fontWeight: 700
20494
20828
  },
20495
- children: /* @__PURE__ */ jsx22(Star3, { size: 14, style: { pointerEvents: "none" } })
20829
+ children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
20496
20830
  }
20497
20831
  ),
20498
- activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx22(
20832
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
20499
20833
  ItemInteractionLayer,
20500
20834
  {
20501
20835
  rect: activeBlockRect,
20502
20836
  state: toolbarState,
20503
- toolbar: /* @__PURE__ */ jsx22(
20837
+ toolbar: /* @__PURE__ */ jsx23(
20504
20838
  VideoToolbar,
20505
20839
  {
20506
20840
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20575,10 +20909,10 @@ function setCarouselAutoplay(tree, on) {
20575
20909
  }
20576
20910
 
20577
20911
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20578
- import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20912
+ import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
20579
20913
  var PRIMARY6 = "#0885FE";
20580
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20581
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20914
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
20915
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20582
20916
  function findCarouselItemElement(sectionId, index) {
20583
20917
  const sectionEl = findByInstanceId(sectionId);
20584
20918
  if (!sectionEl) return null;
@@ -20657,8 +20991,8 @@ function requestAssetPick2(postToParent2) {
20657
20991
  postToParent2({ type: "ow:asset-pick", id });
20658
20992
  });
20659
20993
  }
20660
- function Pill3({ label, onClick, disabled }) {
20661
- return /* @__PURE__ */ jsx23(
20994
+ function Pill2({ label, onClick, disabled }) {
20995
+ return /* @__PURE__ */ jsx24(
20662
20996
  "button",
20663
20997
  {
20664
20998
  type: "button",
@@ -20674,7 +21008,7 @@ function Pill3({ label, onClick, disabled }) {
20674
21008
  border: "none",
20675
21009
  cursor: disabled ? "default" : "pointer",
20676
21010
  background: "#ffffff",
20677
- color: OHW_BLUE_DARK3,
21011
+ color: OHW_BLUE_DARK2,
20678
21012
  opacity: disabled ? 0.4 : 1,
20679
21013
  fontSize: 12,
20680
21014
  lineHeight: "16px",
@@ -20692,7 +21026,7 @@ function TogglePill({
20692
21026
  onToggle,
20693
21027
  disabled
20694
21028
  }) {
20695
- return /* @__PURE__ */ jsxs14(
21029
+ return /* @__PURE__ */ jsxs15(
20696
21030
  "button",
20697
21031
  {
20698
21032
  type: "button",
@@ -20711,7 +21045,7 @@ function TogglePill({
20711
21045
  border: "none",
20712
21046
  cursor: disabled ? "default" : "pointer",
20713
21047
  background: "#ffffff",
20714
- color: OHW_BLUE_DARK3,
21048
+ color: OHW_BLUE_DARK2,
20715
21049
  opacity: disabled ? 0.4 : 1,
20716
21050
  fontSize: 12,
20717
21051
  lineHeight: "16px",
@@ -20721,7 +21055,7 @@ function TogglePill({
20721
21055
  },
20722
21056
  children: [
20723
21057
  label,
20724
- /* @__PURE__ */ jsx23(
21058
+ /* @__PURE__ */ jsx24(
20725
21059
  "span",
20726
21060
  {
20727
21061
  "aria-hidden": true,
@@ -20734,10 +21068,10 @@ function TogglePill({
20734
21068
  // Off is a grey track, not a washed-out blue: the pill's own white background already
20735
21069
  // carries the brand colour in the text, and a pale blue track next to it read as
20736
21070
  // "disabled control" rather than "switch that is off".
20737
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21071
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20738
21072
  transition: "background 120ms ease"
20739
21073
  },
20740
- children: /* @__PURE__ */ jsx23(
21074
+ children: /* @__PURE__ */ jsx24(
20741
21075
  "span",
20742
21076
  {
20743
21077
  style: {
@@ -20766,7 +21100,7 @@ function CarouselSlideToolbar({
20766
21100
  onChangeImage,
20767
21101
  onToggleAutoplay
20768
21102
  }) {
20769
- return /* @__PURE__ */ jsxs14(
21103
+ return /* @__PURE__ */ jsxs15(
20770
21104
  "div",
20771
21105
  {
20772
21106
  "data-ohw-bridge": "",
@@ -20777,7 +21111,7 @@ function CarouselSlideToolbar({
20777
21111
  flexDirection: "column",
20778
21112
  gap: 6,
20779
21113
  alignItems: "center",
20780
- background: OHW_BLUE3,
21114
+ background: OHW_BLUE2,
20781
21115
  padding: 8,
20782
21116
  borderRadius: 12,
20783
21117
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20789,11 +21123,11 @@ function CarouselSlideToolbar({
20789
21123
  pointerEvents: pending ? "none" : "auto"
20790
21124
  },
20791
21125
  children: [
20792
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
20793
- /* @__PURE__ */ jsx23(Pill3, { label: "Change Image", onClick: onChangeImage }),
20794
- /* @__PURE__ */ jsx23(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21126
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21127
+ /* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
21128
+ /* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
20795
21129
  ] }),
20796
- error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21130
+ error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20797
21131
  ]
20798
21132
  }
20799
21133
  );
@@ -20933,8 +21267,8 @@ function AiFadeCarouselOverlay({
20933
21267
  const activeItemRect = useLiveItemRect2(active);
20934
21268
  const TOOLBAR_APPROX_H = 90;
20935
21269
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20936
- return /* @__PURE__ */ jsxs14(Fragment10, { children: [
20937
- hoverHandleRect && hover && /* @__PURE__ */ jsx23(
21270
+ return /* @__PURE__ */ jsxs15(Fragment10, { children: [
21271
+ hoverHandleRect && hover && /* @__PURE__ */ jsx24(
20938
21272
  "button",
20939
21273
  {
20940
21274
  type: "button",
@@ -20963,10 +21297,10 @@ function AiFadeCarouselOverlay({
20963
21297
  fontSize: 14,
20964
21298
  fontWeight: 700
20965
21299
  },
20966
- children: /* @__PURE__ */ jsx23(Star4, { size: 14, style: { pointerEvents: "none" } })
21300
+ children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
20967
21301
  }
20968
21302
  ),
20969
- swapping && /* @__PURE__ */ jsx23(
21303
+ swapping && /* @__PURE__ */ jsx24(
20970
21304
  "div",
20971
21305
  {
20972
21306
  ref: skeletonRef,
@@ -20984,15 +21318,15 @@ function AiFadeCarouselOverlay({
20984
21318
  zIndex: 2147483646,
20985
21319
  pointerEvents: "none"
20986
21320
  },
20987
- children: /* @__PURE__ */ jsx23("style", { children: MEDIA_SKELETON_CSS })
21321
+ children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
20988
21322
  }
20989
21323
  ),
20990
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx23(
21324
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
20991
21325
  ItemInteractionLayer,
20992
21326
  {
20993
21327
  rect: activeItemRect,
20994
21328
  state: toolbarState,
20995
- toolbar: /* @__PURE__ */ jsx23(
21329
+ toolbar: /* @__PURE__ */ jsx24(
20996
21330
  CarouselSlideToolbar,
20997
21331
  {
20998
21332
  pending,
@@ -21183,118 +21517,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21183
21517
  // src/ui/link-modal/LinkPopover.tsx
21184
21518
  import { useEffect as useEffect15 } from "react";
21185
21519
 
21186
- // src/ui/dialog.tsx
21187
- import * as React9 from "react";
21188
- import { Dialog as DialogPrimitive } from "radix-ui";
21189
- import { X as X2 } from "lucide-react";
21190
- import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
21191
- function Dialog2({
21192
- ...props
21193
- }) {
21194
- return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
21195
- }
21196
- function DialogPortal({
21197
- ...props
21198
- }) {
21199
- return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
21200
- }
21201
- function DialogOverlay({
21202
- className,
21203
- ...props
21204
- }) {
21205
- return /* @__PURE__ */ jsx24(
21206
- DialogPrimitive.Overlay,
21207
- {
21208
- "data-slot": "dialog-overlay",
21209
- "data-ohw-link-modal-root": "",
21210
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21211
- ...props
21212
- }
21213
- );
21214
- }
21215
- var DialogContent = React9.forwardRef(
21216
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21217
- const positionMode = container ? "absolute" : "fixed";
21218
- return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
21219
- /* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21220
- /* @__PURE__ */ jsxs15(
21221
- DialogPrimitive.Content,
21222
- {
21223
- ref,
21224
- "data-slot": "dialog-content",
21225
- className: cn(
21226
- positionMode,
21227
- "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",
21228
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21229
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21230
- className
21231
- ),
21232
- onMouseDown: (e) => e.stopPropagation(),
21233
- ...props,
21234
- children: [
21235
- children,
21236
- showCloseButton ? /* @__PURE__ */ jsx24(
21237
- DialogPrimitive.Close,
21238
- {
21239
- type: "button",
21240
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21241
- "aria-label": "Close",
21242
- children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
21243
- }
21244
- ) : null
21245
- ]
21246
- }
21247
- )
21248
- ] });
21249
- }
21250
- );
21251
- DialogContent.displayName = DialogPrimitive.Content.displayName;
21252
- function DialogHeader({
21253
- className,
21254
- ...props
21255
- }) {
21256
- return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21257
- }
21258
- function DialogFooter({
21259
- className,
21260
- ...props
21261
- }) {
21262
- return /* @__PURE__ */ jsx24(
21263
- "div",
21264
- {
21265
- className: cn("flex items-center justify-end gap-2", className),
21266
- ...props
21267
- }
21268
- );
21269
- }
21270
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21271
- DialogPrimitive.Title,
21272
- {
21273
- ref,
21274
- className: cn(
21275
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21276
- className
21277
- ),
21278
- ...props
21279
- }
21280
- ));
21281
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
21282
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21283
- DialogPrimitive.Description,
21284
- {
21285
- ref,
21286
- className: cn("text-sm text-muted-foreground", className),
21287
- ...props
21288
- }
21289
- ));
21290
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
21291
- var DialogClose = DialogPrimitive.Close;
21292
-
21293
21520
  // src/ui/link-modal/LinkEditorPanel.tsx
21294
21521
  import { Info, X as X4 } from "lucide-react";
21295
21522
 
21296
21523
  // src/ui/link-modal/DestinationBreadcrumb.tsx
21297
- import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
21524
+ import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
21298
21525
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
21299
21526
  function DestinationBreadcrumb({
21300
21527
  pageTitle,
@@ -21308,7 +21535,7 @@ function DestinationBreadcrumb({
21308
21535
  /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
21309
21536
  ] }),
21310
21537
  /* @__PURE__ */ jsx25(
21311
- ArrowRight2,
21538
+ ArrowRight3,
21312
21539
  {
21313
21540
  size: 16,
21314
21541
  className: "shrink-0 text-muted-foreground",
@@ -21420,7 +21647,7 @@ function Label({ className, ...props }) {
21420
21647
  }
21421
21648
 
21422
21649
  // src/ui/link-modal/UrlOrPageInput.tsx
21423
- import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
21650
+ import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
21424
21651
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
21425
21652
  function FieldChevron({
21426
21653
  onClick
@@ -21433,7 +21660,7 @@ function FieldChevron({
21433
21660
  onClick,
21434
21661
  "aria-label": "Open page list",
21435
21662
  tabIndex: -1,
21436
- children: /* @__PURE__ */ jsx29(ChevronDown4, { size: 16 })
21663
+ children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
21437
21664
  }
21438
21665
  );
21439
21666
  }
@@ -21663,7 +21890,7 @@ function LinkEditorPanel({ state, onClose }) {
21663
21890
  // src/ui/link-modal/SectionPickerOverlay.tsx
21664
21891
  import { useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
21665
21892
  import { createPortal as createPortal2 } from "react-dom";
21666
- import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
21893
+ import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
21667
21894
  import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
21668
21895
 
21669
21896
  // src/lib/parent-scroll.ts
@@ -21940,7 +22167,7 @@ function SectionPickerOverlay({
21940
22167
  className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
21941
22168
  onClick: onBack,
21942
22169
  children: [
21943
- /* @__PURE__ */ jsx31(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
22170
+ /* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
21944
22171
  "Back"
21945
22172
  ]
21946
22173
  }
@@ -22009,7 +22236,7 @@ function SectionPickerOverlay({
22009
22236
  className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
22010
22237
  style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
22011
22238
  "aria-hidden": true,
22012
- children: /* @__PURE__ */ jsx31(Check3, { className: "size-5" })
22239
+ children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
22013
22240
  }
22014
22241
  ) : null
22015
22242
  ]
@@ -22393,6 +22620,7 @@ function shouldUseDevFixtures() {
22393
22620
  function getLogoElement(el) {
22394
22621
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22395
22622
  if (marked) return marked;
22623
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22396
22624
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22397
22625
  if (!root) return null;
22398
22626
  const anchor = el.closest("a");
@@ -22462,7 +22690,7 @@ function addFooterColumnWithPersist({
22462
22690
  import {
22463
22691
  useCallback as useCallback9,
22464
22692
  useEffect as useEffect16,
22465
- useLayoutEffect as useLayoutEffect5,
22693
+ useLayoutEffect as useLayoutEffect6,
22466
22694
  useRef as useRef11,
22467
22695
  useState as useState15
22468
22696
  } from "react";
@@ -22559,7 +22787,7 @@ function FloatingPanel({
22559
22787
  return () => window.removeEventListener("message", onParentScroll);
22560
22788
  }, [open]);
22561
22789
  const positionRef = useRef11(position);
22562
- useLayoutEffect5(() => {
22790
+ useLayoutEffect6(() => {
22563
22791
  if (!open) {
22564
22792
  positionRef.current = position;
22565
22793
  return;
@@ -22569,7 +22797,7 @@ function FloatingPanel({
22569
22797
  }
22570
22798
  positionRef.current = position;
22571
22799
  }, [open, position, liveScroll, parentScroll]);
22572
- useLayoutEffect5(() => {
22800
+ useLayoutEffect6(() => {
22573
22801
  if (!open || !panelRef.current) return;
22574
22802
  const el = panelRef.current;
22575
22803
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -22778,7 +23006,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
22778
23006
  }
22779
23007
 
22780
23008
  // src/ui/button-style-panel.tsx
22781
- import { Check as Check4 } from "lucide-react";
23009
+ import { Check as Check5 } from "lucide-react";
22782
23010
  import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
22783
23011
  var SIZE_LABEL = { s: "S", m: "M", l: "L" };
22784
23012
  function ButtonStylePanel({
@@ -22849,7 +23077,7 @@ function ButtonStylePanel({
22849
23077
  {
22850
23078
  className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
22851
23079
  "aria-hidden": true,
22852
- children: /* @__PURE__ */ jsx35(Check4, { className: "size-3", strokeWidth: 3 })
23080
+ children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
22853
23081
  }
22854
23082
  ) : null
22855
23083
  ]
@@ -23874,7 +24102,7 @@ function useSectionDrag({
23874
24102
  }
23875
24103
 
23876
24104
  // src/ui/footer-container-chrome.tsx
23877
- import { Plus as Plus3 } from "lucide-react";
24105
+ import { Plus as Plus4 } from "lucide-react";
23878
24106
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
23879
24107
  function FooterContainerChrome({
23880
24108
  rect,
@@ -23915,7 +24143,7 @@ function FooterContainerChrome({
23915
24143
  if (addDisabled) return;
23916
24144
  onAdd();
23917
24145
  },
23918
- children: /* @__PURE__ */ jsx36(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24146
+ children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
23919
24147
  }
23920
24148
  ) }),
23921
24149
  /* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
@@ -24093,6 +24321,138 @@ function deleteSelectedNavFooterItem(deps) {
24093
24321
  return false;
24094
24322
  }
24095
24323
 
24324
+ // src/lib/build-page-sync.ts
24325
+ import { useEffect as useEffect19 } from "react";
24326
+ var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
24327
+ function normalisePath(path) {
24328
+ const trimmed = path.trim().replace(/[?#].*$/u, "");
24329
+ if (!trimmed || trimmed === "/") return "/";
24330
+ return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
24331
+ }
24332
+ function isDeadPageHref(href, livePaths) {
24333
+ const value = href.trim();
24334
+ if (!value.startsWith("/") || value.startsWith("//")) return false;
24335
+ const path = normalisePath(value);
24336
+ if (path === "/") return false;
24337
+ return !livePaths.some((live) => {
24338
+ const p = normalisePath(live);
24339
+ return p === path || p !== "/" && path.startsWith(`${p}/`);
24340
+ });
24341
+ }
24342
+ var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
24343
+ function planBuildPageSync(links, msg) {
24344
+ const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
24345
+ const removed = new Set((msg.removed ?? []).map(normalisePath));
24346
+ const remove = [];
24347
+ const relabel = [];
24348
+ const retarget = [];
24349
+ const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
24350
+ for (const link of links) {
24351
+ const href = link.href.trim();
24352
+ const isPage = href.startsWith("/") && !href.startsWith("//");
24353
+ if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
24354
+ if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
24355
+ else remove.push(link.hrefKey);
24356
+ continue;
24357
+ }
24358
+ if (isPage) {
24359
+ const path = normalisePath(href);
24360
+ const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
24361
+ if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
24362
+ relabel.push({ hrefKey: link.hrefKey, label: rename.label });
24363
+ }
24364
+ continue;
24365
+ }
24366
+ if (href.startsWith("#") || href.startsWith("/#")) {
24367
+ const anchor = href.replace(/^\/?#/u, "").toLowerCase();
24368
+ const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
24369
+ if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
24370
+ relabel.push({ hrefKey: link.hrefKey, label: target.label });
24371
+ }
24372
+ }
24373
+ }
24374
+ return { remove, relabel, retarget };
24375
+ }
24376
+ function linkHref(el) {
24377
+ const key = el.getAttribute("data-ohw-href-key");
24378
+ const stored = key ? getStoredLinkHref(key) : void 0;
24379
+ return stored ?? el.getAttribute("href") ?? "";
24380
+ }
24381
+ function labelEl(anchor) {
24382
+ return anchor.querySelector('[data-ohw-editable="text"]');
24383
+ }
24384
+ function collectLinks() {
24385
+ const seen = /* @__PURE__ */ new Set();
24386
+ const links = [];
24387
+ document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
24388
+ const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
24389
+ if (seen.has(hrefKey)) return;
24390
+ const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
24391
+ if (!area) return;
24392
+ const label = labelEl(el);
24393
+ if (!label && area !== "chrome") return;
24394
+ seen.add(hrefKey);
24395
+ links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
24396
+ });
24397
+ return links;
24398
+ }
24399
+ function applyBuildPageSync(msg, deps) {
24400
+ const plan = planBuildPageSync(collectLinks(), msg);
24401
+ const nodes = /* @__PURE__ */ new Map();
24402
+ for (const hrefKey of plan.remove) {
24403
+ const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
24404
+ if (!anchor) continue;
24405
+ const nav = isNavbarHrefKey(hrefKey);
24406
+ const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
24407
+ if (!result) continue;
24408
+ for (const key of result.removedKeys) {
24409
+ nodes.set(key, "");
24410
+ clearStoredLinkHref(key);
24411
+ }
24412
+ nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
24413
+ }
24414
+ for (const { hrefKey, label } of plan.relabel) {
24415
+ const labelKey = hrefKey.replace(/-href$/u, "-label");
24416
+ document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
24417
+ const el = labelEl(anchor);
24418
+ if (el) el.textContent = label;
24419
+ });
24420
+ nodes.set(labelKey, label);
24421
+ }
24422
+ for (const { hrefKey, href } of plan.retarget) {
24423
+ setStoredLinkHref(hrefKey, href);
24424
+ document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
24425
+ if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
24426
+ });
24427
+ nodes.set(hrefKey, href);
24428
+ }
24429
+ if (nodes.size === 0) return 0;
24430
+ deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
24431
+ deps.postToParent({
24432
+ type: "ow:change",
24433
+ nodes: [...nodes].map(([key, text]) => ({ key, text }))
24434
+ });
24435
+ return plan.remove.length + plan.relabel.length + plan.retarget.length;
24436
+ }
24437
+ function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
24438
+ useEffect19(() => {
24439
+ if (!isEditMode) return;
24440
+ const onMessage = (e) => {
24441
+ if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
24442
+ const changed = applyBuildPageSync(e.data, {
24443
+ getEditContent: () => editContentRef.current,
24444
+ setEditContent: (next) => {
24445
+ editContentRef.current = next;
24446
+ },
24447
+ postToParent: postToParent2
24448
+ });
24449
+ postToParent2({ type: "ow:pages-synced", changed });
24450
+ };
24451
+ window.addEventListener("message", onMessage);
24452
+ return () => window.removeEventListener("message", onMessage);
24453
+ }, [isEditMode, editContentRef, postToParent2]);
24454
+ }
24455
+
24096
24456
  // src/lib/nav-page-sync.ts
24097
24457
  function labelKeyFor(hrefKey) {
24098
24458
  return hrefKey.replace(/-href$/, "-label");
@@ -24190,7 +24550,7 @@ function retargetPageLinks(change, deps) {
24190
24550
  }
24191
24551
 
24192
24552
  // src/ui/navbar-container-chrome.tsx
24193
- import { Plus as Plus4 } from "lucide-react";
24553
+ import { Plus as Plus5 } from "lucide-react";
24194
24554
  import { jsx as jsx37 } from "react/jsx-runtime";
24195
24555
  function NavbarContainerChrome({
24196
24556
  rect,
@@ -24226,7 +24586,7 @@ function NavbarContainerChrome({
24226
24586
  e.stopPropagation();
24227
24587
  onAdd();
24228
24588
  },
24229
- children: /* @__PURE__ */ jsx37(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24589
+ children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24230
24590
  }
24231
24591
  )
24232
24592
  }
@@ -24298,7 +24658,7 @@ function Badge({ className, variant, ...props }) {
24298
24658
  }
24299
24659
 
24300
24660
  // src/OhhwellsBridge.tsx
24301
- import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings } from "lucide-react";
24661
+ import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
24302
24662
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
24303
24663
  var PRIMARY7 = "#0885FE";
24304
24664
  var IMAGE_FADE_MS = 300;
@@ -25076,7 +25436,7 @@ function getNavigationSelectionParent(el) {
25076
25436
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25077
25437
  return resolveFooterLinksContainerFrom(el);
25078
25438
  }
25079
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25439
+ 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)) {
25080
25440
  return getNavigationRoot(el);
25081
25441
  }
25082
25442
  return null;
@@ -25298,7 +25658,6 @@ var ICONS = {
25298
25658
  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"/>',
25299
25659
  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"/>'
25300
25660
  };
25301
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25302
25661
  var SELECTION_CHROME_GAP2 = 4;
25303
25662
  var TOOLBAR_STROKE_GAP2 = 4;
25304
25663
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25396,7 +25755,7 @@ function applyVisibleViewport(el, parentScroll) {
25396
25755
  el.style.top = `${top}px`;
25397
25756
  el.style.height = `${height}px`;
25398
25757
  }
25399
- var TOOLBAR_EDGE_MARGIN3 = 4;
25758
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25400
25759
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25401
25760
  const isAbove = transform.includes("translateY(-100%)");
25402
25761
  let visualTop = isAbove ? top - approxH : top;
@@ -25423,8 +25782,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25423
25782
  function clampToolbarLeft(centerX, toolbarWidth) {
25424
25783
  const half = toolbarWidth / 2;
25425
25784
  return Math.max(
25426
- TOOLBAR_EDGE_MARGIN3 + half,
25427
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
25785
+ TOOLBAR_EDGE_MARGIN4 + half,
25786
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25428
25787
  );
25429
25788
  }
25430
25789
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -25798,7 +26157,7 @@ function OhhwellsBridge() {
25798
26157
  const searchParams = useSearchParams();
25799
26158
  const isEditMode = isEditSessionActive();
25800
26159
  const [bridgeRoot, setBridgeRoot] = useState18(null);
25801
- useEffect19(() => {
26160
+ useEffect20(() => {
25802
26161
  const figtreeFontId = "ohw-figtree-font";
25803
26162
  if (!document.getElementById(figtreeFontId)) {
25804
26163
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -25825,7 +26184,7 @@ function OhhwellsBridge() {
25825
26184
  }, []);
25826
26185
  const subdomainFromQuery = searchParams.get("subdomain");
25827
26186
  const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
25828
- useLayoutEffect6(() => {
26187
+ useLayoutEffect7(() => {
25829
26188
  const next = resolveSubdomain(subdomainFromQuery);
25830
26189
  if (next !== subdomain) setSubdomain(next);
25831
26190
  if (next) return;
@@ -25837,7 +26196,7 @@ function OhhwellsBridge() {
25837
26196
  }, 0);
25838
26197
  return () => window.clearTimeout(t);
25839
26198
  }, [subdomainFromQuery, subdomain]);
25840
- useEffect19(() => {
26199
+ useEffect20(() => {
25841
26200
  if (!subdomainFromQuery || typeof window === "undefined") return;
25842
26201
  const url = new URL(window.location.href);
25843
26202
  if (!url.searchParams.has("subdomain")) return;
@@ -25857,14 +26216,14 @@ function OhhwellsBridge() {
25857
26216
  const [fetchState, setFetchState] = useState18("idle");
25858
26217
  const [showBranding, setShowBranding] = useState18(false);
25859
26218
  const autoSaveTimers = useRef14(/* @__PURE__ */ new Map());
25860
- useEffect19(() => {
26219
+ useEffect20(() => {
25861
26220
  stampBridgeVersionOnDocument();
25862
26221
  }, []);
25863
- useEffect19(() => {
26222
+ useEffect20(() => {
25864
26223
  if (isEditMode) return;
25865
26224
  return armLoaderHangBeacon(subdomain, fetchState);
25866
26225
  }, [isEditMode, subdomain, fetchState]);
25867
- useEffect19(() => {
26226
+ useEffect20(() => {
25868
26227
  if (isEditMode || !subdomain) return;
25869
26228
  const onError = (event) => {
25870
26229
  reportOutageBeacon({
@@ -26005,7 +26364,7 @@ function OhhwellsBridge() {
26005
26364
  }, []);
26006
26365
  const selectMediaElementRef = useRef14(selectMediaElement);
26007
26366
  selectMediaElementRef.current = selectMediaElement;
26008
- useEffect19(() => {
26367
+ useEffect20(() => {
26009
26368
  if (!selectedMedia) return;
26010
26369
  const update = () => {
26011
26370
  const el = selectedMediaElRef.current;
@@ -26220,7 +26579,7 @@ function OhhwellsBridge() {
26220
26579
  const [fieldDragging, setFieldDragging] = useState18(false);
26221
26580
  const clearFormPickRef = useRef14(clearFormPick);
26222
26581
  clearFormPickRef.current = clearFormPick;
26223
- useEffect19(() => {
26582
+ useEffect20(() => {
26224
26583
  const el = fieldPickElRef.current;
26225
26584
  if (!el || fieldPickRect === null) return;
26226
26585
  const observer = new ResizeObserver(() => {
@@ -26229,7 +26588,7 @@ function OhhwellsBridge() {
26229
26588
  observer.observe(el);
26230
26589
  return () => observer.disconnect();
26231
26590
  }, [fieldPickRect !== null, fieldPickState]);
26232
- useEffect19(() => {
26591
+ useEffect20(() => {
26233
26592
  const el = formPickElRef.current;
26234
26593
  if (!el || formPickRect === null) return;
26235
26594
  const observer = new ResizeObserver(() => {
@@ -26256,7 +26615,7 @@ function OhhwellsBridge() {
26256
26615
  const hoveredItemElRef = useRef14(null);
26257
26616
  const [hoveredItemRect, setHoveredItemRect] = useState18(null);
26258
26617
  const [hoveredTextRect, setHoveredTextRect] = useState18(null);
26259
- useEffect19(() => {
26618
+ useEffect20(() => {
26260
26619
  const sync = () => {
26261
26620
  const el = document.querySelector(
26262
26621
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -26306,21 +26665,6 @@ function OhhwellsBridge() {
26306
26665
  const [isItemDragging, setIsItemDragging] = useState18(false);
26307
26666
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
26308
26667
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26309
- const [floatingPanel, setFloatingPanel] = useState18(null);
26310
- const floatingPanelOpenRef = useRef14(false);
26311
- floatingPanelOpenRef.current = floatingPanel !== null;
26312
- const floatingPanelRef = useRef14(null);
26313
- floatingPanelRef.current = floatingPanel;
26314
- const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26315
- const buttonCollectionDragRef = useRef14(null);
26316
- const buttonDropInsertIndexRef = useRef14(null);
26317
- const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26318
- const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26319
- const buttonPointerDragRef = useRef14(null);
26320
- const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26321
- const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26322
- const [editorViewport, setEditorViewport] = useState18("desktop");
26323
- const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26324
26668
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
26325
26669
  const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
26326
26670
  const footerDragRef = useRef14(null);
@@ -26334,6 +26678,7 @@ function OhhwellsBridge() {
26334
26678
  const linkPopoverSessionRef = useRef14(null);
26335
26679
  const addNavAfterAnchorRef = useRef14(null);
26336
26680
  const editContentRef = useRef14({});
26681
+ useBuildPageSync(isEditMode, editContentRef, postToParent2);
26337
26682
  const aiSectionsRef = useRef14("");
26338
26683
  const aiFooterRef = useRef14("");
26339
26684
  const applyTreeLocalRef = useRef14(
@@ -26346,6 +26691,21 @@ function OhhwellsBridge() {
26346
26691
  const stylesRef = useRef14("");
26347
26692
  const appliedDrawerRef = useRef14(null);
26348
26693
  const pendingDeleteUndoRef = useRef14(null);
26694
+ const [floatingPanel, setFloatingPanel] = useState18(null);
26695
+ const floatingPanelOpenRef = useRef14(false);
26696
+ const floatingPanelRef = useRef14(null);
26697
+ floatingPanelRef.current = floatingPanel;
26698
+ const setFloatingPanelRef = useRef14(setFloatingPanel);
26699
+ const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26700
+ const buttonCollectionDragRef = useRef14(null);
26701
+ const buttonDropInsertIndexRef = useRef14(null);
26702
+ const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26703
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26704
+ const buttonPointerDragRef = useRef14(null);
26705
+ const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26706
+ const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26707
+ const [editorViewport, setEditorViewport] = useState18("desktop");
26708
+ const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26349
26709
  const [sitePages, setSitePages] = useState18([]);
26350
26710
  const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
26351
26711
  const [sectionsByPath, setSectionsByPath] = useState18({});
@@ -26355,8 +26715,19 @@ function OhhwellsBridge() {
26355
26715
  const linkPopoverOpenRef = useRef14(false);
26356
26716
  const linkPopoverGraceUntilRef = useRef14(0);
26357
26717
  setLinkPopoverRef.current = setLinkPopover;
26718
+ setFloatingPanelRef.current = setFloatingPanel;
26358
26719
  linkPopoverSessionRef.current = linkPopover;
26359
- useEffect19(() => {
26720
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
26721
+ useEffect20(() => {
26722
+ const syncViewport = () => {
26723
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26724
+ setEditorViewport((prev) => prev === next ? prev : next);
26725
+ };
26726
+ syncViewport();
26727
+ window.addEventListener("resize", syncViewport);
26728
+ return () => window.removeEventListener("resize", syncViewport);
26729
+ }, []);
26730
+ useEffect20(() => {
26360
26731
  setSectionOrderPersistHandler((entries) => {
26361
26732
  const currentPath = window.location.pathname;
26362
26733
  const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
@@ -26366,7 +26737,7 @@ function OhhwellsBridge() {
26366
26737
  });
26367
26738
  return () => setSectionOrderPersistHandler(null);
26368
26739
  }, []);
26369
- useEffect19(() => {
26740
+ useEffect20(() => {
26370
26741
  setAiFooterMountOptions({
26371
26742
  resolvePageHref: (pageOrAnchorId) => {
26372
26743
  const [pageId, anchor] = pageOrAnchorId.split("#");
@@ -26450,7 +26821,7 @@ function OhhwellsBridge() {
26450
26821
  }, [isEditMode, pathname]);
26451
26822
  const runSectionsPrefetchRef = useRef14(runSectionsPrefetch);
26452
26823
  runSectionsPrefetchRef.current = runSectionsPrefetch;
26453
- useEffect19(() => {
26824
+ useEffect20(() => {
26454
26825
  if (!linkPopover) {
26455
26826
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26456
26827
  return;
@@ -26478,7 +26849,7 @@ function OhhwellsBridge() {
26478
26849
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26479
26850
  };
26480
26851
  }, [linkPopover, postToParent2]);
26481
- useEffect19(() => {
26852
+ useEffect20(() => {
26482
26853
  if (!isEditMode) return;
26483
26854
  const useFixtures = shouldUseDevFixtures();
26484
26855
  if (useFixtures) {
@@ -26504,7 +26875,7 @@ function OhhwellsBridge() {
26504
26875
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
26505
26876
  return () => window.removeEventListener("message", onSitePages);
26506
26877
  }, [isEditMode, postToParent2]);
26507
- useEffect19(() => {
26878
+ useEffect20(() => {
26508
26879
  if (!isEditMode) return;
26509
26880
  const deps = {
26510
26881
  getEditContent: () => editContentRef.current,
@@ -26541,14 +26912,14 @@ function OhhwellsBridge() {
26541
26912
  window.addEventListener("message", onPageMessage);
26542
26913
  return () => window.removeEventListener("message", onPageMessage);
26543
26914
  }, [isEditMode, postToParent2]);
26544
- useEffect19(() => {
26915
+ useEffect20(() => {
26545
26916
  if (!isEditMode || shouldUseDevFixtures()) return;
26546
26917
  void loadAllSectionsManifest().then((manifest) => {
26547
26918
  if (Object.keys(manifest).length === 0) return;
26548
26919
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
26549
26920
  });
26550
26921
  }, [isEditMode]);
26551
- useEffect19(() => {
26922
+ useEffect20(() => {
26552
26923
  const update = () => {
26553
26924
  const el = activeElRef.current ?? selectedElRef.current;
26554
26925
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -27807,7 +28178,7 @@ function OhhwellsBridge() {
27807
28178
  },
27808
28179
  [postToParent2]
27809
28180
  );
27810
- useEffect19(() => {
28181
+ useEffect20(() => {
27811
28182
  const onDragOver = (e) => {
27812
28183
  const dragged = buttonCollectionDragRef.current;
27813
28184
  if (!dragged) return;
@@ -27878,7 +28249,7 @@ function OhhwellsBridge() {
27878
28249
  setLogoSizeDraft(null);
27879
28250
  deselectRef.current();
27880
28251
  }, []);
27881
- useEffect19(() => {
28252
+ useEffect20(() => {
27882
28253
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
27883
28254
  if (!session || !logoSizeDraft) {
27884
28255
  postToParentRef.current({ type: "ow:logo-size-panel", open: false });
@@ -28036,7 +28407,7 @@ function OhhwellsBridge() {
28036
28407
  deselectRef.current = deselect;
28037
28408
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
28038
28409
  const lastSiteWideScopeRef = useRef14(null);
28039
- useEffect19(() => {
28410
+ useEffect20(() => {
28040
28411
  if (!isEditMode) {
28041
28412
  if (lastSiteWideScopeRef.current !== false) {
28042
28413
  lastSiteWideScopeRef.current = false;
@@ -28062,7 +28433,7 @@ function OhhwellsBridge() {
28062
28433
  isFooterFrameSelection,
28063
28434
  postToParent2
28064
28435
  ]);
28065
- useLayoutEffect6(() => {
28436
+ useLayoutEffect7(() => {
28066
28437
  if (!subdomain || isEditMode) {
28067
28438
  setFetchState("done");
28068
28439
  return;
@@ -28089,6 +28460,7 @@ function OhhwellsBridge() {
28089
28460
  applyAiFooterFromContent(content);
28090
28461
  if (typeof content[STYLE_STORE_KEY] === "string") {
28091
28462
  stylesRef.current = content[STYLE_STORE_KEY];
28463
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28092
28464
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28093
28465
  }
28094
28466
  applyBrandChrome(content);
@@ -28099,15 +28471,16 @@ function OhhwellsBridge() {
28099
28471
  if (key === "__ohw_sections") continue;
28100
28472
  if (key === AI_SECTIONS_KEY) continue;
28101
28473
  if (key === AI_FOOTER_KEY) continue;
28474
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28475
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28102
28476
  if (key === BRAND_KIT_KEY) continue;
28103
28477
  if (key === STYLE_STORE_KEY) continue;
28104
28478
  if (BRAND_CHROME_KEYS.has(key)) continue;
28105
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28106
28479
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28107
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28108
28480
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28109
28481
  continue;
28110
28482
  }
28483
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28111
28484
  if (applyVideoSettingNode(key, val)) continue;
28112
28485
  if (applyCarouselNode(key, val)) continue;
28113
28486
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28147,6 +28520,7 @@ function OhhwellsBridge() {
28147
28520
  });
28148
28521
  applyLinkByKey(key, val);
28149
28522
  }
28523
+ applySectionEmbeds(content);
28150
28524
  applyLogoFromContent(content);
28151
28525
  applyLogoSizes(content);
28152
28526
  reconcileNavbarItemsFromContent(content);
@@ -28213,7 +28587,7 @@ function OhhwellsBridge() {
28213
28587
  cancelled = true;
28214
28588
  };
28215
28589
  }, [subdomain, isEditMode]);
28216
- useEffect19(() => {
28590
+ useEffect20(() => {
28217
28591
  if (!isEditMode) return;
28218
28592
  const resolveIndex = (form, clientY) => {
28219
28593
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -28254,7 +28628,7 @@ function OhhwellsBridge() {
28254
28628
  window.removeEventListener("drop", onDrop, true);
28255
28629
  };
28256
28630
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
28257
- useEffect19(() => {
28631
+ useEffect20(() => {
28258
28632
  if (!isEditMode) return;
28259
28633
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28260
28634
  markFormFields(form);
@@ -28266,7 +28640,7 @@ function OhhwellsBridge() {
28266
28640
  });
28267
28641
  return () => observer.disconnect();
28268
28642
  }, [isEditMode, fetchState, pathname]);
28269
- useEffect19(() => {
28643
+ useEffect20(() => {
28270
28644
  if (!isEditMode) return;
28271
28645
  let saveTimer = null;
28272
28646
  const onInput = (e) => {
@@ -28288,14 +28662,14 @@ function OhhwellsBridge() {
28288
28662
  document.addEventListener("input", onInput, true);
28289
28663
  return () => document.removeEventListener("input", onInput, true);
28290
28664
  }, [isEditMode, persistFields]);
28291
- useEffect19(() => {
28665
+ useEffect20(() => {
28292
28666
  if (isEditMode || fetchState !== "done") return;
28293
28667
  const content = contentCache.get(subdomain) ?? {};
28294
28668
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28295
28669
  reconcileFieldsFromContent(form, content);
28296
28670
  });
28297
28671
  }, [isEditMode, fetchState, subdomain]);
28298
- useEffect19(() => {
28672
+ useEffect20(() => {
28299
28673
  if (!isEditMode) return;
28300
28674
  const swallow = (e) => {
28301
28675
  const target = e.target;
@@ -28304,14 +28678,14 @@ function OhhwellsBridge() {
28304
28678
  document.addEventListener("submit", swallow, true);
28305
28679
  return () => document.removeEventListener("submit", swallow, true);
28306
28680
  }, [isEditMode]);
28307
- useEffect19(() => {
28681
+ useEffect20(() => {
28308
28682
  if (isEditMode || fetchState !== "done") return;
28309
28683
  console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
28310
28684
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
28311
28685
  console.log({ apiUrl, subdomain });
28312
28686
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
28313
28687
  }, [isEditMode, fetchState, subdomain]);
28314
- useEffect19(() => {
28688
+ useEffect20(() => {
28315
28689
  if (!subdomain || isEditMode) return;
28316
28690
  let debounceTimer = null;
28317
28691
  let observer = null;
@@ -28335,20 +28709,22 @@ function OhhwellsBridge() {
28335
28709
  }
28336
28710
  applyAiFooterFromContent(content);
28337
28711
  if (typeof content[STYLE_STORE_KEY] === "string") {
28712
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28338
28713
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28339
28714
  }
28340
28715
  for (const [key, val] of Object.entries(content)) {
28341
28716
  if (key === "__ohw_sections") continue;
28342
28717
  if (key === AI_SECTIONS_KEY) continue;
28343
28718
  if (key === AI_FOOTER_KEY) continue;
28719
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28720
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28344
28721
  if (key === BRAND_KIT_KEY) continue;
28345
28722
  if (key === STYLE_STORE_KEY) continue;
28346
28723
  if (BRAND_CHROME_KEYS.has(key)) continue;
28347
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28348
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28349
28724
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28350
28725
  continue;
28351
28726
  }
28727
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28352
28728
  if (applyVideoSettingNode(key, val)) continue;
28353
28729
  if (applyCarouselNode(key, val)) continue;
28354
28730
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28373,6 +28749,7 @@ function OhhwellsBridge() {
28373
28749
  });
28374
28750
  applyLinkByKey(key, val);
28375
28751
  }
28752
+ applySectionEmbeds(content);
28376
28753
  applyLogoFromContent(content);
28377
28754
  reconcileNavbarItemsFromContent(content);
28378
28755
  reconcileFooterOrderFromContent(content);
@@ -28428,16 +28805,16 @@ function OhhwellsBridge() {
28428
28805
  if (debounceTimer) clearTimeout(debounceTimer);
28429
28806
  };
28430
28807
  }, [subdomain, isEditMode, pathname]);
28431
- useLayoutEffect6(() => {
28808
+ useLayoutEffect7(() => {
28432
28809
  const el = document.getElementById("ohw-loader");
28433
28810
  if (!el) return;
28434
28811
  const visible = Boolean(subdomain) && fetchState !== "done";
28435
28812
  el.style.display = visible ? "flex" : "none";
28436
28813
  }, [subdomain, fetchState]);
28437
- useEffect19(() => {
28814
+ useEffect20(() => {
28438
28815
  postToParent2({ type: "ow:navigation", path: pathname });
28439
28816
  }, [pathname, postToParent2]);
28440
- useEffect19(() => {
28817
+ useEffect20(() => {
28441
28818
  if (!subdomain || isEditMode) return;
28442
28819
  const content = contentCache.get(subdomain);
28443
28820
  if (!content) return;
@@ -28455,7 +28832,7 @@ function OhhwellsBridge() {
28455
28832
  }
28456
28833
  applyAiFooterFromContent(content);
28457
28834
  }, [pathname, subdomain, isEditMode]);
28458
- useEffect19(() => {
28835
+ useEffect20(() => {
28459
28836
  if (!isEditMode) return;
28460
28837
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
28461
28838
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -28463,12 +28840,12 @@ function OhhwellsBridge() {
28463
28840
  deselectRef.current();
28464
28841
  deactivateRef.current();
28465
28842
  }, [pathname, isEditMode]);
28466
- useEffect19(() => {
28843
+ useEffect20(() => {
28467
28844
  if (!isEditMode) return;
28468
28845
  initSectionInstancesFromContent(editContentRef.current, pathname);
28469
28846
  initItemInstancesFromContent(editContentRef.current);
28470
28847
  }, [pathname, isEditMode]);
28471
- useEffect19(() => {
28848
+ useEffect20(() => {
28472
28849
  if (!isEditMode) return;
28473
28850
  const observer = new MutationObserver(() => {
28474
28851
  const drawer = document.querySelector("[data-ohw-nav-drawer]");
@@ -28479,7 +28856,7 @@ function OhhwellsBridge() {
28479
28856
  observer.observe(document.body, { childList: true, subtree: true });
28480
28857
  return () => observer.disconnect();
28481
28858
  }, [isEditMode, pathname]);
28482
- useEffect19(() => {
28859
+ useEffect20(() => {
28483
28860
  const contentForNav = () => {
28484
28861
  if (isEditMode) return editContentRef.current;
28485
28862
  if (!subdomain) return {};
@@ -28552,7 +28929,7 @@ function OhhwellsBridge() {
28552
28929
  observer?.disconnect();
28553
28930
  };
28554
28931
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
28555
- useEffect19(() => {
28932
+ useEffect20(() => {
28556
28933
  if (!isEditMode) return;
28557
28934
  let applying = false;
28558
28935
  let rafId = null;
@@ -28590,7 +28967,7 @@ function OhhwellsBridge() {
28590
28967
  observer.disconnect();
28591
28968
  };
28592
28969
  }, [isEditMode, pathname]);
28593
- useEffect19(() => {
28970
+ useEffect20(() => {
28594
28971
  if (!isEditMode) return;
28595
28972
  let lastPosted = 0;
28596
28973
  const measure = () => {
@@ -28612,29 +28989,14 @@ function OhhwellsBridge() {
28612
28989
  const t2 = setTimeout(measure, 500);
28613
28990
  const ro = new ResizeObserver(schedule);
28614
28991
  ro.observe(document.body);
28615
- let lastWidth = window.innerWidth;
28616
- let resizeTimers = [];
28617
- const clearResizeTimers = () => {
28618
- resizeTimers.forEach(clearTimeout);
28619
- resizeTimers = [];
28620
- };
28621
- const handleResize = () => {
28622
- if (window.innerWidth === lastWidth) return;
28623
- lastWidth = window.innerWidth;
28624
- clearResizeTimers();
28625
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
28626
- };
28627
- window.addEventListener("resize", handleResize);
28628
28992
  return () => {
28629
28993
  clearTimeout(t1);
28630
28994
  clearTimeout(t2);
28631
28995
  if (raf != null) cancelAnimationFrame(raf);
28632
28996
  ro.disconnect();
28633
- clearResizeTimers();
28634
- window.removeEventListener("resize", handleResize);
28635
28997
  };
28636
28998
  }, [pathname, isEditMode, postToParent2]);
28637
- useEffect19(() => {
28999
+ useEffect20(() => {
28638
29000
  if (isEditMode) return;
28639
29001
  const handleClick = (e) => {
28640
29002
  if (!isPlainLeftClick(e)) return;
@@ -28648,7 +29010,7 @@ function OhhwellsBridge() {
28648
29010
  document.addEventListener("click", handleClick, true);
28649
29011
  return () => document.removeEventListener("click", handleClick, true);
28650
29012
  }, [isEditMode, router, pathname]);
28651
- useEffect19(() => {
29013
+ useEffect20(() => {
28652
29014
  if (!isEditMode) {
28653
29015
  editStylesRef.current?.base.remove();
28654
29016
  editStylesRef.current?.forceHover.remove();
@@ -28928,6 +29290,13 @@ function OhhwellsBridge() {
28928
29290
  if (target.closest("[data-ohw-state-toggle]")) return;
28929
29291
  if (target.closest("[data-ohw-max-badge]")) return;
28930
29292
  if (isInsideLinkEditor(target)) return;
29293
+ if (isInsideFloatingPanel(target)) return;
29294
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29295
+ if (target.closest(
29296
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29297
+ )) {
29298
+ return;
29299
+ }
28931
29300
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
28932
29301
  clearMediaSelectionRef.current();
28933
29302
  }
@@ -28951,8 +29320,6 @@ function OhhwellsBridge() {
28951
29320
  return;
28952
29321
  }
28953
29322
  }
28954
- if (isInsideFloatingPanel(target)) return;
28955
- if (target.closest("[data-ohw-form-toolbar]")) return;
28956
29323
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
28957
29324
  if (collectionItem) {
28958
29325
  e.preventDefault();
@@ -28964,11 +29331,6 @@ function OhhwellsBridge() {
28964
29331
  });
28965
29332
  return;
28966
29333
  }
28967
- if (target.closest(
28968
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
28969
- )) {
28970
- return;
28971
- }
28972
29334
  {
28973
29335
  const formEl = getFormElement(target);
28974
29336
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29122,9 +29484,13 @@ function OhhwellsBridge() {
29122
29484
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29123
29485
  e.preventDefault();
29124
29486
  e.stopPropagation();
29125
- selectIconElementRef.current(editable);
29126
29487
  const aiIcon = editable.hasAttribute("data-ai-icon");
29127
29488
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29489
+ if (aiIcon) {
29490
+ aiSectionApiRef.current?.selectFromElement(editable);
29491
+ } else {
29492
+ selectIconElementRef.current(editable);
29493
+ }
29128
29494
  postToParentRef.current({
29129
29495
  type: "ow:icon-pick",
29130
29496
  key: editable.dataset.ohwKey ?? "",
@@ -29352,6 +29718,9 @@ function OhhwellsBridge() {
29352
29718
  setHoveredItemRect(null);
29353
29719
  hoveredNavContainerRef.current = null;
29354
29720
  setHoveredNavContainerRect(null);
29721
+ siblingHintElRef.current = null;
29722
+ setSiblingHintRect(null);
29723
+ setSiblingHintRects([]);
29355
29724
  return;
29356
29725
  }
29357
29726
  {
@@ -29472,7 +29841,6 @@ function OhhwellsBridge() {
29472
29841
  hoveredNavContainerRef.current = null;
29473
29842
  setHoveredNavContainerRect(null);
29474
29843
  hoveredItemElRef.current = editable;
29475
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29476
29844
  }
29477
29845
  }
29478
29846
  }
@@ -30182,7 +30550,11 @@ function OhhwellsBridge() {
30182
30550
  };
30183
30551
  const handleMouseMove = (e) => {
30184
30552
  const { clientX, clientY } = e;
30185
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30553
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30554
+ dismissImageHover();
30555
+ clearImageHover();
30556
+ return;
30557
+ }
30186
30558
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30187
30559
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30188
30560
  formHoverElRef.current = null;
@@ -30211,7 +30583,12 @@ function OhhwellsBridge() {
30211
30583
  setHoveredItemRect(null);
30212
30584
  hoveredNavContainerRef.current = null;
30213
30585
  setHoveredNavContainerRect(null);
30586
+ siblingHintElRef.current = null;
30587
+ setSiblingHintRect(null);
30588
+ setSiblingHintRects([]);
30214
30589
  dismissImageHover();
30590
+ clearImageHover();
30591
+ setSectionGap(null);
30215
30592
  return;
30216
30593
  }
30217
30594
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30223,7 +30600,11 @@ function OhhwellsBridge() {
30223
30600
  if (e.data?.type !== "ow:pointer-sync") return;
30224
30601
  const { clientX, clientY } = e.data;
30225
30602
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30226
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30603
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30604
+ dismissImageHover();
30605
+ clearImageHover();
30606
+ return;
30607
+ }
30227
30608
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30228
30609
  if (probeSocialsRowAt(clientX, clientY)) return;
30229
30610
  probeSectionGapAt(clientX, clientY);
@@ -30603,6 +30984,7 @@ function OhhwellsBridge() {
30603
30984
  applyAiFooterFromContent(content);
30604
30985
  if (typeof content[STYLE_STORE_KEY] === "string") {
30605
30986
  stylesRef.current = content[STYLE_STORE_KEY];
30987
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
30606
30988
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
30607
30989
  }
30608
30990
  applyBrandChrome(content);
@@ -30617,15 +30999,16 @@ function OhhwellsBridge() {
30617
30999
  }
30618
31000
  if (key === AI_SECTIONS_KEY) continue;
30619
31001
  if (key === AI_FOOTER_KEY) continue;
31002
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31003
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
30620
31004
  if (key === BRAND_KIT_KEY) continue;
30621
31005
  if (key === STYLE_STORE_KEY) continue;
30622
31006
  if (BRAND_CHROME_KEYS.has(key)) continue;
30623
- if (key === LOGO_PLACEHOLDER_KEY) continue;
30624
31007
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30625
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
30626
31008
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
30627
31009
  continue;
30628
31010
  }
31011
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
30629
31012
  if (applyVideoSettingNode(key, val)) continue;
30630
31013
  if (applyCarouselNode(key, val)) continue;
30631
31014
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -30651,6 +31034,7 @@ function OhhwellsBridge() {
30651
31034
  });
30652
31035
  applyLinkByKey(key, val);
30653
31036
  }
31037
+ applySectionEmbeds(content);
30654
31038
  applyLogoFromContent(content);
30655
31039
  applyLogoSizes(content);
30656
31040
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -30878,6 +31262,31 @@ function OhhwellsBridge() {
30878
31262
  postAiSectionsChanged();
30879
31263
  };
30880
31264
  window.addEventListener("message", handleAiDeleteSection);
31265
+ const handleAiMoveSection = (e) => {
31266
+ if (e.data?.type !== "ow:ai-move-section") return;
31267
+ const sectionId = typeof e.data.sectionId === "string" ? e.data.sectionId : "";
31268
+ const targetPage = typeof e.data.targetPage === "string" ? e.data.targetPage : "";
31269
+ if (!sectionId || !targetPage) return;
31270
+ const previous = aiSectionsRef.current;
31271
+ const nextState = moveSectionInState(parseAiSectionsState(previous), sectionId, targetPage);
31272
+ if (!nextState) return;
31273
+ clearInteractionChrome();
31274
+ const nextValue = serializeAiSectionsState(nextState);
31275
+ aiSectionsRef.current = nextValue;
31276
+ applyAiSectionsToDom(nextState);
31277
+ const newHeight = document.body.scrollHeight;
31278
+ if (newHeight > 50) postToParentRef.current({ type: "ow:height", height: newHeight });
31279
+ postToParentRef.current({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: nextValue }] });
31280
+ postToParentRef.current({
31281
+ type: "ow:ai-section-moved",
31282
+ sectionId,
31283
+ targetPage,
31284
+ previous,
31285
+ value: nextValue
31286
+ });
31287
+ postAiSectionsChanged();
31288
+ };
31289
+ window.addEventListener("message", handleAiMoveSection);
30881
31290
  const handleAiSetSections = (e) => {
30882
31291
  if (e.data?.type !== "ow:ai-set-sections") return;
30883
31292
  const value = typeof e.data.value === "string" ? e.data.value : "";
@@ -31258,6 +31667,12 @@ function OhhwellsBridge() {
31258
31667
  closeLinkPopoverRef.current();
31259
31668
  return;
31260
31669
  }
31670
+ if (floatingPanelOpenRef.current) {
31671
+ setFloatingPanelRef.current(null);
31672
+ deselectRef.current();
31673
+ deactivateRef.current();
31674
+ return;
31675
+ }
31261
31676
  deselectRef.current();
31262
31677
  deactivateRef.current();
31263
31678
  clearMediaSelectionRef.current();
@@ -32077,6 +32492,7 @@ function OhhwellsBridge() {
32077
32492
  window.removeEventListener("message", handleAiApplyTree);
32078
32493
  window.removeEventListener("message", handleAiApplyFooter);
32079
32494
  window.removeEventListener("message", handleAiDeleteSection);
32495
+ window.removeEventListener("message", handleAiMoveSection);
32080
32496
  window.removeEventListener("message", handleAiSetSections);
32081
32497
  window.removeEventListener("message", handleAiSetBrand);
32082
32498
  window.removeEventListener("message", handleAiSetStyles);
@@ -32093,17 +32509,17 @@ function OhhwellsBridge() {
32093
32509
  window.removeEventListener("message", handleDuplicateSection);
32094
32510
  window.removeEventListener("message", handleDeactivate);
32095
32511
  window.removeEventListener("message", handleSelectNav);
32096
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32097
32512
  window.removeEventListener("message", handleToastAction);
32098
32513
  window.removeEventListener("message", handleFormCount);
32099
32514
  window.removeEventListener("message", handleUiEscape);
32515
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32100
32516
  autoSaveTimers.current.forEach(clearTimeout);
32101
32517
  autoSaveTimers.current.clear();
32102
32518
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
32103
32519
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
32104
32520
  };
32105
32521
  }, [isEditMode, refreshStateRules]);
32106
- useEffect19(() => {
32522
+ useEffect20(() => {
32107
32523
  if (!isEditMode) return;
32108
32524
  const THRESHOLD = 10;
32109
32525
  const resolveWasSelected = (el) => {
@@ -32259,7 +32675,7 @@ function OhhwellsBridge() {
32259
32675
  unlockFooterDragInteraction();
32260
32676
  };
32261
32677
  }, [isEditMode]);
32262
- useEffect19(() => {
32678
+ useEffect20(() => {
32263
32679
  if (!isEditMode) return;
32264
32680
  const THRESHOLD = 10;
32265
32681
  const onPointerDown = (e) => {
@@ -32350,7 +32766,7 @@ function OhhwellsBridge() {
32350
32766
  document.removeEventListener("selectstart", blockSelectStart, true);
32351
32767
  };
32352
32768
  }, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
32353
- useEffect19(() => {
32769
+ useEffect20(() => {
32354
32770
  const handler = (e) => {
32355
32771
  if (e.data?.type !== "ow:request-schedule-config") return;
32356
32772
  const insertAfterVal = e.data.insertAfter;
@@ -32366,7 +32782,7 @@ function OhhwellsBridge() {
32366
32782
  window.addEventListener("message", handler);
32367
32783
  return () => window.removeEventListener("message", handler);
32368
32784
  }, [processConfigRequest]);
32369
- useEffect19(() => {
32785
+ useEffect20(() => {
32370
32786
  if (!isEditMode) return;
32371
32787
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
32372
32788
  el.removeAttribute("data-ohw-active-state");
@@ -32390,7 +32806,7 @@ function OhhwellsBridge() {
32390
32806
  postToParent2({
32391
32807
  type: "ow:ready",
32392
32808
  version: "1",
32393
- bridgeVersion: "0.1.163",
32809
+ bridgeVersion: "0.1.164-next.439",
32394
32810
  path: pathname,
32395
32811
  nodes: collectEditableNodes(editContentRef.current),
32396
32812
  sections
@@ -32402,7 +32818,7 @@ function OhhwellsBridge() {
32402
32818
  clearTimeout(timer);
32403
32819
  };
32404
32820
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
32405
- useEffect19(() => {
32821
+ useEffect20(() => {
32406
32822
  scrollToHashSectionWhenReady();
32407
32823
  const onHashChange = () => scrollToHashSectionWhenReady();
32408
32824
  window.addEventListener("hashchange", onHashChange);
@@ -32444,7 +32860,7 @@ function OhhwellsBridge() {
32444
32860
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
32445
32861
  refreshActiveCommandsRef.current();
32446
32862
  }, []);
32447
- useEffect19(() => {
32863
+ useEffect20(() => {
32448
32864
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
32449
32865
  if (!session || !logoSizeDraft) return;
32450
32866
  const onPanelAction = (e) => {
@@ -33125,7 +33541,7 @@ function OhhwellsBridge() {
33125
33541
  className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
33126
33542
  onClick: () => setFieldTypePickerOpen((open) => !open),
33127
33543
  "data-ohw-add-field": "",
33128
- children: /* @__PURE__ */ jsx40(Plus5, { size: 15, "aria-hidden": true })
33544
+ children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
33129
33545
  }
33130
33546
  ),
33131
33547
  /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
@@ -33618,6 +34034,7 @@ export {
33618
34034
  hasMountedContentNodes,
33619
34035
  indexCollectionItems,
33620
34036
  insertFooterHours,
34037
+ isDeadPageHref,
33621
34038
  isEditSessionActive,
33622
34039
  isPlainLeftClick,
33623
34040
  isRenderableFooterTree,
@@ -33629,6 +34046,7 @@ export {
33629
34046
  parseAiFooterState,
33630
34047
  parseAiSectionsState,
33631
34048
  parseTarget,
34049
+ planBuildPageSync,
33632
34050
  recordOverriddenPaths,
33633
34051
  releaseTemplateLogoIfReplaced,
33634
34052
  removeFooterBlock,